Commits

Waldemar Kornewald committed 8140f88

added all sub-paths to non-redirected paths (RedirectMiddleware)

  • Participants
  • Parent commits 1f759d2

Comments (0)

Files changed (1)

djangotoolbox/middleware.py

 
 ALLOWED_DOMAINS = getattr(settings, 'ALLOWED_DOMAINS', None)
 NON_REDIRECTED_PATHS = getattr(settings, 'NON_REDIRECTED_PATHS', ())
+NON_REDIRECTED_BASE_PATHS = tuple(path.rstrip('/') + '/'
+                                  for path in NON_REDIRECTED_PATHS)
 
 class LoginRequiredMiddleware(object):
     """
                 not ALLOWED_DOMAINS or
                 request.META.get('HTTP_X_APPENGINE_CRON') == 'true' or
                 request.path.startswith('/_ah/') or
-                request.path in NON_REDIRECTED_PATHS):
+                request.path in NON_REDIRECTED_PATHS or
+                request.path.startswith(NON_REDIRECTED_BASE_PATHS)):
             return
         if host not in settings.ALLOWED_DOMAINS:
             return HttpResponseRedirect('http://' + settings.ALLOWED_DOMAINS[0])