service.py

changeset 61
0c9b09f694f3
parent 55
0f1d046b3f78
child 63
20865458d936
equal deleted inserted replaced
60:aab788e8a725 61:0c9b09f694f3
57 else: 57 else:
58 for language_name in tr.languages: 58 for language_name in tr.languages:
59 if request.args.get(language_name) is not None: 59 if request.args.get(language_name) is not None:
60 return language_name 60 return language_name
61 else: 61 else:
62 return 'fi' 62 return request.accept_languages.best_match(tr.languages)
63 63
64 def sign(schedule_entry): 64 def sign(schedule_entry):
65 from math import ceil 65 from math import ceil
66 trip_length = schedule_entry['trip'].length - schedule_entry['stop'].traveled_distance 66 trip_length = schedule_entry['trip'].length - schedule_entry['stop'].traveled_distance
67 sign = reduce_schedule(schedule_entry['trip'].concise_schedule(schedule_entry['stop']), trip_length = trip_length) 67 sign = reduce_schedule(schedule_entry['trip'].concise_schedule(schedule_entry['stop']), trip_length = trip_length)

mercurial