PEP8 cleanups

This commit is contained in:
Roberto Rosario
2011-04-08 01:31:39 -04:00
parent 61fb876a81
commit 1b6806f7d1
13 changed files with 173 additions and 167 deletions
@@ -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']: