Fixed problems with middleware order

This commit is contained in:
Raphael Michel
2016-07-20 19:33:26 +02:00
parent f9cd4f02d3
commit 525705a912
3 changed files with 13 additions and 5 deletions

View File

@@ -24,6 +24,9 @@ class LocaleMiddleware:
def process_request(self, request: HttpRequest):
language = get_language_from_request(request)
# Normally, this middleware runs *before* the event is set. However, on event frontend pages it
# might be run a second time by pretix.presale.EventMiddleware and in this case the event is already
# set and can be taken into account for the decision.
if hasattr(request, 'event') and not request.path.startswith(get_script_prefix() + 'control'):
if language not in request.event.settings.locales:
firstpart = language.split('-')[0]