Commit 76b75701 authored by Zachary Seguin's avatar Zachary Seguin

Merge branch 'fix-25' into 'master'

Support non-localized urls (Resolves #25)

Closes #25

See merge request !14
parents 88269fef 265b9967
Pipeline #146 canceled with stages
in 1 minute and 44 seconds
......@@ -104,6 +104,14 @@ def active_alerts():
alerts=helpers.active_alerts()
)
@ac_web.route('/settings')
def old_settings():
return flask.redirect(
flask.url_for('alerts_canada.settings',
lang=flask.session.get('lang', app.config['BABEL_DEFAULT_LOCALE'])
)
)
@ac_web.route('/<lang>/settings')
def settings():
return flask.render_template('settings.html', title=gettext('Settings'))
......@@ -119,6 +127,14 @@ def do_settings():
flask.flash(gettext('Your settings have been saved.'), 'success')
return flask.redirect(flask.url_for('alerts_canada.settings'))
@ac_web.route('/archive')
def old_alerts_archive():
return flask.redirect(
flask.url_for('alerts_canada.alerts_archive',
lang=flask.session.get('lang', app.config['BABEL_DEFAULT_LOCALE'])
)
)
@ac_web.route('/<lang>/archive')
def alerts_archive():
from flask import request
......@@ -144,6 +160,15 @@ def alerts_archive():
return flask.render_template('archive.html', title=gettext('Alerts archive'))
@ac_web.route('/alert/<alert_id>')
def old_alert(alert_id):
return flask.redirect(
flask.url_for('alerts_canada.alert',
lang=flask.session.get('lang', app.config['BABEL_DEFAULT_LOCALE']),
alert_id=alert_id
)
)
@ac_web.route('/<lang>/alert/<alert_id>')
def alert(alert_id):
if not alert_id.isdigit():
......@@ -174,6 +199,18 @@ def alert(alert_id):
references = references
)
@ac_web.route('/resource/<alert_id>/<info_id>/<resource_id>/<uri>')
def old_alert_resource_by_uri(alert_id):
return flask.redirect(
flask.url_for('alerts_canada.alert_resource_by_uri',
lang=flask.session.get('lang', app.config['BABEL_DEFAULT_LOCALE']),
alert_id=alert_id,
info_id=info_id,
resource_id=resource_id,
uri=uri
)
)
@ac_web.route('/<lang>/resource/<alert_id>/<info_id>/<resource_id>/<uri>')
def alert_resource_by_uri(alert_id, info_id, resource_id, uri):
resource = Resource.query.filter(
......@@ -188,6 +225,17 @@ def alert_resource_by_uri(alert_id, info_id, resource_id, uri):
decoded = base64.b64decode(str(data), '-_')
return flask.Response(decoded, mimetype=resource.mime_type)
@ac_web.route('/resource/<alert_id>/<info_id>/<resource_id>')
def old_alert_resource(alert_id, info_id, resource_id):
return flask.redirect(
flask.url_for('alerts_canada.alert_resource',
lang=flask.session.get('lang', app.config['BABEL_DEFAULT_LOCALE']),
alert_id=alert_id,
info_id=info_id,
resource_id=resource_id
)
)
@ac_web.route('/<lang>/resource/<alert_id>/<info_id>/<resource_id>')
def alert_resource(alert_id, info_id, resource_id):
resource = Resource.query.filter(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment