PEP8, pylint cleanups and removal of relative imports
This commit is contained in:
@@ -86,7 +86,7 @@ class DetailForm(forms.ModelForm):
|
||||
queryset=getattr(field, 'queryset', None),
|
||||
)
|
||||
self.fields[field_name].help_text = ''
|
||||
|
||||
|
||||
for field_name, field in self.fields.items():
|
||||
self.fields[field_name].widget.attrs.update({'readonly': 'readonly'})
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from re import compile
|
||||
import re
|
||||
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.conf import settings
|
||||
|
||||
EXEMPT_URLS = [compile(settings.LOGIN_URL.lstrip('/'))]
|
||||
EXEMPT_URLS = [re.compile(settings.LOGIN_URL.lstrip('/'))]
|
||||
if hasattr(settings, 'LOGIN_EXEMPT_URLS'):
|
||||
EXEMPT_URLS += [compile(expr) for expr in settings.LOGIN_EXEMPT_URLS]
|
||||
EXEMPT_URLS += [re.compile(expr) for expr in settings.LOGIN_EXEMPT_URLS]
|
||||
|
||||
|
||||
class LoginRequiredMiddleware:
|
||||
|
||||
@@ -4,6 +4,6 @@ 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']:
|
||||
if u'text/html' in response['Content-Type']:
|
||||
response.content = short(response.content)
|
||||
return response
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import re
|
||||
import types
|
||||
@@ -9,7 +9,7 @@ from django.utils.datastructures import MultiValueDict
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
def urlquote(link=None, get={}):
|
||||
def urlquote(link=None, get=None):
|
||||
u'''
|
||||
This method does both: urlquote() and urlencode()
|
||||
|
||||
@@ -26,6 +26,9 @@ def urlquote(link=None, get={}):
|
||||
urlquote('/mypath/', {'key': ['value1', 'value2']}) --> '/mypath/?key=value1&key=value2'
|
||||
urlquote({'key': ['value1', 'value2']}) --> 'key=value1&key=value2'
|
||||
'''
|
||||
if get is None:
|
||||
get = []
|
||||
|
||||
assert link or get
|
||||
if isinstance(link, dict):
|
||||
# urlqoute({'key': 'value', 'key2': 'value2'}) --> key=value&key2=value2
|
||||
@@ -48,7 +51,7 @@ def urlquote(link=None, get={}):
|
||||
return django_urlquote(link)
|
||||
|
||||
|
||||
def return_attrib(obj, attrib, arguments={}):
|
||||
def return_attrib(obj, attrib, arguments=None):
|
||||
try:
|
||||
if isinstance(attrib, types.FunctionType):
|
||||
return attrib(obj)
|
||||
|
||||
@@ -14,7 +14,7 @@ from django.utils.hashcompat import md5_constructor
|
||||
__all__ = ('security_hash', 'BoundFormWizard')
|
||||
|
||||
|
||||
def security_hash(request, form, exclude=None, *args):
|
||||
def security_hash_new(form, exclude=None, *args):
|
||||
"""Calculates a security hash for the given Form/FormSet instance.
|
||||
|
||||
This creates a list of the form field names/values in a deterministic
|
||||
@@ -60,7 +60,7 @@ class BoundFormWizard(FormWizard):
|
||||
Subclasses may want to take into account request-specific information,
|
||||
such as the IP address.
|
||||
"""
|
||||
return security_hash(request, form)
|
||||
return security_hash_new(form)
|
||||
|
||||
def render(self, form, request, step, context=None):
|
||||
"Renders the given Form object, returning an HttpResponse."
|
||||
|
||||
Reference in New Issue
Block a user