From 695fd022abb2dc6218d6bb72269574c6c8bd9008 Mon Sep 17 00:00:00 2001 From: Tomas Orsava Date: Sat, 21 Aug 2021 15:07:20 +0200 Subject: [PATCH] Add subdomain redirect aliases for `plzenske`, `olomoucke` and more Also move the redirect aliases definition closer to the BACKCOMPAT_SERIES_ALIASES. Fixes: #91 --- pyvocz/views.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pyvocz/views.py b/pyvocz/views.py index 353c96c..7899e31 100644 --- a/pyvocz/views.py +++ b/pyvocz/views.py @@ -31,6 +31,18 @@ } +REDIRECT_SERIES_ALIASES = { + 'brnenske': 'brno-pyvo', + 'ostravske': 'ostrava-pyvo', + 'prazske': 'praha-pyvo', + 'prague': 'praha-pyvo', + 'plzenske': 'plzen-pyvo', + 'pilsen': 'plzen-pyvo', + 'olomoucke': 'olomouc-pyvo', + **BACKCOMPAT_SERIES_ALIASES, +} + + # Be careful when using SimpleCache! # See: http://werkzeug.pocoo.org/docs/contrib/cache/ # #werkzeug.contrib.cache.SimpleCache @@ -495,14 +507,7 @@ def reload_hook(): @route('/', subdomain='') def subdomain_redirect(subdomain): - ALIASES = { - 'brnenske': 'brno-pyvo', - 'ostravske': 'ostrava-pyvo', - 'prazske': 'praha-pyvo', - 'prague': 'praha-pyvo', - **BACKCOMPAT_SERIES_ALIASES, - } - subdomain = ALIASES.get(subdomain, subdomain) + subdomain = REDIRECT_SERIES_ALIASES.get(subdomain, subdomain) return redirect(url_for('series', series_slug=subdomain))