PEP8 cleanups
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
from re import compile
|
||||
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.conf import settings
|
||||
from re import compile
|
||||
|
||||
EXEMPT_URLS = [compile(settings.LOGIN_URL.lstrip('/'))]
|
||||
if hasattr(settings, 'LOGIN_EXEMPT_URLS'):
|
||||
EXEMPT_URLS += [compile(expr) for expr in settings.LOGIN_EXEMPT_URLS]
|
||||
|
||||
|
||||
class LoginRequiredMiddleware:
|
||||
"""
|
||||
Middleware that requires a user to be authenticated to view any page other
|
||||
@@ -28,4 +30,3 @@ class LoginRequiredMiddleware:
|
||||
path = request.path_info.lstrip('/')
|
||||
if not any(m.match(path) for m in EXEMPT_URLS):
|
||||
return HttpResponseRedirect(settings.LOGIN_URL)
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Aliasing it for the sake of page size.
|
||||
from django.utils.html import strip_spaces_between_tags as short
|
||||
|
||||
|
||||
class SpacelessMiddleware(object):
|
||||
def process_response(self, request, response):
|
||||
if 'text/html' in response['Content-Type']:
|
||||
|
||||
Reference in New Issue
Block a user