Skip to content

Commit 695fd02

Browse files
committed
Add subdomain redirect aliases for plzenske, olomoucke and more
Also move the redirect aliases definition closer to the BACKCOMPAT_SERIES_ALIASES. Fixes: pyvec#91
1 parent 62c6cc4 commit 695fd02

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

pyvocz/views.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@
3131
}
3232

3333

34+
REDIRECT_SERIES_ALIASES = {
35+
'brnenske': 'brno-pyvo',
36+
'ostravske': 'ostrava-pyvo',
37+
'prazske': 'praha-pyvo',
38+
'prague': 'praha-pyvo',
39+
'plzenske': 'plzen-pyvo',
40+
'pilsen': 'plzen-pyvo',
41+
'olomoucke': 'olomouc-pyvo',
42+
**BACKCOMPAT_SERIES_ALIASES,
43+
}
44+
45+
3446
# Be careful when using SimpleCache!
3547
# See: http://werkzeug.pocoo.org/docs/contrib/cache/
3648
# #werkzeug.contrib.cache.SimpleCache
@@ -495,14 +507,7 @@ def reload_hook():
495507

496508
@route('/', subdomain='<subdomain>')
497509
def subdomain_redirect(subdomain):
498-
ALIASES = {
499-
'brnenske': 'brno-pyvo',
500-
'ostravske': 'ostrava-pyvo',
501-
'prazske': 'praha-pyvo',
502-
'prague': 'praha-pyvo',
503-
**BACKCOMPAT_SERIES_ALIASES,
504-
}
505-
subdomain = ALIASES.get(subdomain, subdomain)
510+
subdomain = REDIRECT_SERIES_ALIASES.get(subdomain, subdomain)
506511
return redirect(url_for('series', series_slug=subdomain))
507512

508513

0 commit comments

Comments
 (0)