Skip to content
Snippets Groups Projects
Commit 248d063b authored by Markus Willman's avatar Markus Willman
Browse files

Merge branch 'master' into 'deploy'

update translations one more time, fix invalid url encoding (kiosk break)

See merge request Smart_Bus_Stop/frontend-server!34
parents c3788fbb 62acd8f4
No related branches found
No related tags found
No related merge requests found
......@@ -57,15 +57,15 @@ class PollingThreadReader(object):
while self._running:
apiResponse = None
# FIXME: better exception handling
# TODO: better exception handling
try:
apiResponse = requests.get(self.endpoint, headers = self.requestHeaders).content
except (ConnectionError, HTTPError, Timeout):
apiResponse = requests.get(self.endpoint, headers = self.requestHeaders, timeout = (3.05, 2)).content
except Timeout:
self._stale = True
time.sleep(self.pollTime)
continue
except RequestException:
except (ConnectionError, HTTPError, RequestException):
self._stale = True
time.sleep(self.pollTime)
continue
with self._lock:
......
......@@ -220,7 +220,7 @@
dataType: 'json',
data: $(this).serializeObject()
}).done(function() {
window.location.replace("{{ util.view_url('feedback/thanks') }}");
window.location.replace("{{ util.view_url('feedback/thanks', safe = False) }}");
});
});
});
......
{# this file contains helper macros, not intended for rendering but import, imported as util in main templates. Note the whitespace control #}
{% macro view_url(view_name, context = g.stop_id) -%}
{{ url_for('view', path = view_name, stopId = context, _external = True) }}
{%- macro view_url(view_name, context = g.stop_id, safe = True) -%}
{% autoescape safe %}{{ url_for('view', path = view_name, stopId = context, _external = True) }}{% endautoescape %}
{%- endmacro %}
{% macro static_url(filename) -%}
{{ url_for('static', filename = filename, _external = True) }}
{%- macro static_url(filename, safe = True) -%}
{% autoescape safe %}{{ url_for('static', filename = filename, _external = True) }}{% endautoescape %}
{%- endmacro %}
{% macro home_url(context = g.stop_id, lang = None) -%}
{%- macro home_url(context = g.stop_id, lang = None, safe = True) -%}
{% autoescape safe -%}
{% if not lang -%}
{{ url_for('view', path = '', stopId = context, _external = True) }}
{%- else -%}
{{ url_for('view', path = '', stopId = context, lang = lang, _external = True) }}
{%- endif %}
{%- endautoescape %}
{%- endmacro %}
{# For format string documentation, see: http://babel.pocoo.org/en/latest/dates.html#pattern-syntax #}
{% macro time_short(time) -%}
{#- For format string documentation, see: http://babel.pocoo.org/en/latest/dates.html#pattern-syntax #}
{%- macro time_short(time) -%}
{{ time | datetimeformat(format = 'HH:mm') }}
{%- endmacro %}
{% macro time_long(time) -%}
{%- macro time_long(time) -%}
{{ time | timeformat(format = 'HH:mm:ss') }}
{%- endmacro %}
{% macro date(time) -%}
{%- macro date(time) -%}
{{ time | datetimeformat }}
{%- endmacro %}
{% macro stop_name(full_name = True, context = stop_info) -%}
{%- macro stop_name(full_name = True, context = stop_info) -%}
{% if full_name %}{% if context.stop_code %}{{ context.stop_code }}{% else %}{{ context.stop_id }}{% endif %} - {% endif %}{{ context.stop_name }}
{%- endmacro %}
{# assumes that schedule_row.headsign does not contain the trip/line short_name attribute already, true for Föli data but GTFS does not guarantee this #}
{% macro line_name(schedule_row, full_name = False) -%}
{%- macro line_name(schedule_row, full_name = False) -%}
{% if not full_name or not schedule_row.route -%}
{% if schedule_row.route %}{{ schedule_row.route.short_name }} - {% endif %}{{ schedule_row.headsign }}
{%- else -%}
......@@ -42,7 +44,7 @@
{%- endif %}
{%- endmacro %}
{% macro pagination(context) %}
{%- macro pagination(context) %}
{% if context -%}
<nav>
<ul class="pagination pagination-lg pagination-foli justify-content-center">
......@@ -60,4 +62,4 @@
</ul>
</nav>
{%- endif %}
{% endmacro %}
{% endmacro -%}
......@@ -264,7 +264,7 @@
}
markers = {};
$.getJSON("{{ url_for('apiLocatorService', version = 1, stopId = stop_info.stop_id, type = 'nearby', _external = True) }}",
$.getJSON("{{ url_for('apiLocatorService', version = 1, stopId = stop_info.stop_id, type = 'nearby', _external = True)|safe }}",
function (data) {
console.log('found this many buses: ' + Object.keys(data).length);
$.each( data, function( key, value ) {
......@@ -286,7 +286,7 @@
// mark the map as busy
mapUpdating = true;
$.getJSON("{{ url_for('apiLocatorService', version = 1, stopId = stop_info.stop_id, type = 'nearby', _external = True) }}",
$.getJSON("{{ url_for('apiLocatorService', version = 1, stopId = stop_info.stop_id, type = 'nearby', _external = True)|safe }}",
function (data) {
// poor man's locking
if (trackingLoop === null) {
......@@ -350,7 +350,7 @@
// get information about the focused bus
var requestFocus = focusedMarker;
$.post(
"{{ url_for('apiBusInfo', version = 1, _external = True) }}",
"{{ url_for('apiBusInfo', version = 1, _external = True)|safe }}",
{ bus_id: requestFocus, get_shape: 1 },
function (data) {
// poor man's locking (the A in Ajax is for Asynchronous :))
......@@ -403,7 +403,7 @@
var requestFocus = focusedMarker;
$.post(
"{{ url_for('apiBusInfo', version = 1, _external = True) }}",
"{{ url_for('apiBusInfo', version = 1, _external = True)|safe }}",
{ bus_id: requestFocus, get_shape: 0 },
function (data) {
// poor man's locking
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2018-03-08 06:11+0200\n"
"POT-Creation-Date: 2018-03-11 17:37+0200\n"
"PO-Revision-Date: 2018-02-10 01:33+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
......@@ -56,44 +56,54 @@ msgstr ""
msgid "Give Feedback"
msgstr ""
#: templates/map.html:18
#: templates/map.html:19
msgid "Live Bus Traffic Nearby"
msgstr ""
#: templates/map.html:28 templates/timetables.html:19
#: templates/map.html:29 templates/timetables.html:19
#: templates/timetables.html:54
msgid "Line"
msgstr ""
#: templates/map.html:28 templates/timetables.html:19
#: templates/map.html:29 templates/timetables.html:19
#: templates/timetables.html:55
msgid "Destination"
msgstr ""
#: templates/map.html:29 templates/timetables.html:20
#: templates/map.html:30 templates/timetables.html:20
msgid "Time"
msgstr ""
#: templates/map.html:30 templates/timetables.html:21
#: templates/map.html:31 templates/timetables.html:21
msgid "ETA"
msgstr ""
#: templates/map.html:57
#: templates/map.html:49 templates/timetables.html:39
msgid "Information last updated: "
msgstr ""
#: templates/map.html:55
msgid ""
"The location service is currently not active, the map may show outdated "
"information."
msgstr ""
#: templates/map.html:73
msgid ""
"Location information is updated with a 10-30 second delay. Due to network"
" conditions, latency or lost location updates buses may at times appear "
"to move in an unrealistic way."
msgstr ""
#: templates/map.html:414
#: templates/map.html:448
msgid "Next Stop"
msgstr ""
#: templates/map.html:415
#: templates/map.html:449
msgid "Aimed Arrival"
msgstr ""
#: templates/map.html:416
#: templates/map.html:450
msgid "Expected Arrival"
msgstr ""
......@@ -101,10 +111,6 @@ msgstr ""
msgid "Busses Arriving Soon"
msgstr ""
#: templates/timetables.html:39
msgid "Information last updated: "
msgstr ""
#: templates/timetables.html:46
msgid "Today's Schedule"
msgstr ""
......@@ -251,11 +257,11 @@ msgstr ""
msgid "Swedish"
msgstr ""
#: templates/internal/macros.html:50 templates/internal/macros.html:52
#: templates/internal/macros.html:52 templates/internal/macros.html:54
msgid "Previous"
msgstr ""
#: templates/internal/macros.html:56 templates/internal/macros.html:58
#: templates/internal/macros.html:58 templates/internal/macros.html:60
msgid "Next"
msgstr ""
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2018-03-08 06:11+0200\n"
"POT-Creation-Date: 2018-03-11 17:37+0200\n"
"PO-Revision-Date: 2018-02-10 01:35+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: fi\n"
......@@ -56,29 +56,41 @@ msgstr "Föli Äppi"
msgid "Give Feedback"
msgstr "Anna palautetta"
#: templates/map.html:18
#: templates/map.html:19
msgid "Live Bus Traffic Nearby"
msgstr "Lähistön reaaliaikainen bussiliikenne"
#: templates/map.html:28 templates/timetables.html:19
#: templates/map.html:29 templates/timetables.html:19
#: templates/timetables.html:54
msgid "Line"
msgstr "Linja"
#: templates/map.html:28 templates/timetables.html:19
#: templates/map.html:29 templates/timetables.html:19
#: templates/timetables.html:55
msgid "Destination"
msgstr "Määränpää"
#: templates/map.html:29 templates/timetables.html:20
#: templates/map.html:30 templates/timetables.html:20
msgid "Time"
msgstr "Aika"
#: templates/map.html:30 templates/timetables.html:21
#: templates/map.html:31 templates/timetables.html:21
msgid "ETA"
msgstr "ETA"
#: templates/map.html:57
#: templates/map.html:49 templates/timetables.html:39
msgid "Information last updated: "
msgstr "Tiedot päivitetty viimeksi: "
#: templates/map.html:55
msgid ""
"The location service is currently not active, the map may show outdated "
"information."
msgstr ""
"Paikkatioetopalvelu ei ole juuri nyt aktiivinen, kartta saattaa näyttää "
"vanhentunutta tietoa."
#: templates/map.html:73
msgid ""
"Location information is updated with a 10-30 second delay. Due to network"
" conditions, latency or lost location updates buses may at times appear "
......@@ -88,15 +100,15 @@ msgstr ""
" puutteellisesta paikannuksesta johtuen bussit saattavat paikoitellen "
"liikkua epärealistisella tavalla"
#: templates/map.html:414
#: templates/map.html:448
msgid "Next Stop"
msgstr "Seuraava pysäkki"
#: templates/map.html:415
#: templates/map.html:449
msgid "Aimed Arrival"
msgstr "Tavoitteellinen saapumisaika"
#: templates/map.html:416
#: templates/map.html:450
msgid "Expected Arrival"
msgstr "Odotettu saapumisaika"
......@@ -104,10 +116,6 @@ msgstr "Odotettu saapumisaika"
msgid "Busses Arriving Soon"
msgstr "Pian saapuvat bussit"
#: templates/timetables.html:39
msgid "Information last updated: "
msgstr "Tiedot päivitetty viimeksi: "
#: templates/timetables.html:46
msgid "Today's Schedule"
msgstr "Päivän aikataulu"
......@@ -256,7 +264,7 @@ msgstr ""
#: templates/internal/base.html:159
msgid "About"
msgstr ""
msgstr "Info"
#: templates/internal/base.html:170
msgid "English"
......@@ -270,11 +278,11 @@ msgstr "Suomi"
msgid "Swedish"
msgstr "Ruotsi"
#: templates/internal/macros.html:50 templates/internal/macros.html:52
#: templates/internal/macros.html:52 templates/internal/macros.html:54
msgid "Previous"
msgstr "Edellinen"
#: templates/internal/macros.html:56 templates/internal/macros.html:58
#: templates/internal/macros.html:58 templates/internal/macros.html:60
msgid "Next"
msgstr "Seuraava"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment