diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
index d2e57486e0..5a6b6a24e9 100644
--- a/django/contrib/admin/templatetags/admin_list.py
+++ b/django/contrib/admin/templatetags/admin_list.py
@@ -17,11 +17,11 @@ DOT = '.'
def paginator_number(cl,i):
if i == DOT:
- return '... '
+ return '... '
elif i == cl.page_num:
- return '%d ' % (i+1)
+ return '%d ' % (i+1)
else:
- return '%d ' % (cl.get_query_string({PAGE_VAR: i}), (i == cl.paginator.pages-1 and ' class="end"' or ''), i+1)
+ return '%d ' % (cl.get_query_string({PAGE_VAR: i}), (i == cl.paginator.pages-1 and ' class="end"' or ''), i+1)
paginator_number = register.simple_tag(paginator_number)
def pagination(cl):
@@ -167,7 +167,7 @@ def items_for_result(cl, result):
else:
result_repr = escape(str(field_val))
if result_repr == '':
- result_repr = ' '
+ result_repr = ' '
if first: # First column is a special case
first = False
url = cl.url_for_result(result)
diff --git a/django/contrib/admin/templatetags/admin_modify.py b/django/contrib/admin/templatetags/admin_modify.py
index 60be8a91a7..9f646214ce 100644
--- a/django/contrib/admin/templatetags/admin_modify.py
+++ b/django/contrib/admin/templatetags/admin_modify.py
@@ -102,7 +102,7 @@ class FieldWrapper(object):
return self.field.blank and ' class="optional"' or ''
def use_raw_id_admin(self):
- return isinstance(self.field.rel, (models.ManyToOneRel, models.ManyToManyRel)) \
+ return isinstance(self.field.rel, (models.ManyToOneRel, models.ManyToManyRel)) \
and self.field.rel.raw_id_admin
class FormFieldCollectionWrapper(object):
@@ -183,7 +183,7 @@ auto_populated_field_script = register.simple_tag(auto_populated_field_script)
def filter_interface_script_maybe(bound_field):
f = bound_field.field
if f.rel and isinstance(f.rel, models.ManyToManyRel) and f.rel.filter_interface:
- return '\n' % (
f.name, f.verbose_name, f.rel.filter_interface-1, settings.ADMIN_MEDIA_PREFIX)
else:
diff --git a/django/core/handlers/modpython.py b/django/core/handlers/modpython.py
index 815b96f2e8..ce7f6f1ad2 100644
--- a/django/core/handlers/modpython.py
+++ b/django/core/handlers/modpython.py
@@ -32,7 +32,7 @@ class ModPythonRequest(http.HttpRequest):
def _get_request(self):
if not hasattr(self, '_request'):
- self._request = datastructures.MergeDict(self.POST, self.GET)
+ self._request = datastructures.MergeDict(self.POST, self.GET)
return self._request
def _get_get(self):
diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py
index 46c8c7971c..01dbdf02f1 100644
--- a/django/core/handlers/wsgi.py
+++ b/django/core/handlers/wsgi.py
@@ -79,7 +79,7 @@ class WSGIRequest(http.HttpRequest):
def _get_request(self):
if not hasattr(self, '_request'):
- self._request = datastructures.MergeDict(self.POST, self.GET)
+ self._request = datastructures.MergeDict(self.POST, self.GET)
return self._request
def _get_get(self):
diff --git a/django/core/management.py b/django/core/management.py
index 22fff8e0f2..3838c2abee 100644
--- a/django/core/management.py
+++ b/django/core/management.py
@@ -159,15 +159,15 @@ def _get_sql_model_create(klass, models_already_seen=set()):
if f.primary_key:
field_output.append(style.SQL_KEYWORD('PRIMARY KEY'))
if f.rel:
- if f.rel.to in models_already_seen:
- field_output.append(style.SQL_KEYWORD('REFERENCES') + ' ' + \
- style.SQL_TABLE(backend.quote_name(f.rel.to._meta.db_table)) + ' (' + \
- style.SQL_FIELD(backend.quote_name(f.rel.to._meta.get_field(f.rel.field_name).column)) + ')'
- )
- else:
- # We haven't yet created the table to which this field
- # is related, so save it for later.
- pr = pending_references.setdefault(f.rel.to, []).append((klass, f))
+ if f.rel.to in models_already_seen:
+ field_output.append(style.SQL_KEYWORD('REFERENCES') + ' ' + \
+ style.SQL_TABLE(backend.quote_name(f.rel.to._meta.db_table)) + ' (' + \
+ style.SQL_FIELD(backend.quote_name(f.rel.to._meta.get_field(f.rel.field_name).column)) + ')'
+ )
+ else:
+ # We haven't yet created the table to which this field
+ # is related, so save it for later.
+ pr = pending_references.setdefault(f.rel.to, []).append((klass, f))
table_output.append(' '.join(field_output))
if opts.order_with_respect_to:
table_output.append(style.SQL_FIELD(backend.quote_name('_order')) + ' ' + \
@@ -836,7 +836,7 @@ def get_validation_errors(outfile, app=None):
if f.rel:
rel_opts = f.rel.to._meta
if f.rel.to not in models.get_models():
- e.add(opts, "'%s' has relation with uninstalled model %s" % (f.name, rel_opts.object_name))
+ e.add(opts, "'%s' has relation with uninstalled model %s" % (f.name, rel_opts.object_name))
rel_name = RelatedObject(f.rel.to, cls, f).get_accessor_name()
for r in rel_opts.fields:
diff --git a/django/core/servers/basehttp.py b/django/core/servers/basehttp.py
index e3628f7263..5772912031 100644
--- a/django/core/servers/basehttp.py
+++ b/django/core/servers/basehttp.py
@@ -383,7 +383,7 @@ class ServerHandler:
assert type(data) is StringType,"write() argument must be string"
if not self.status:
- raise AssertionError("write() before start_response()")
+ raise AssertionError("write() before start_response()")
elif not self.headers_sent:
# Before the first output, send the stored headers
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index 87843ceeeb..8cc17079a9 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -305,9 +305,9 @@ class Field(object):
def _get_val_from_obj(self, obj):
if obj:
- return getattr(obj, self.attname)
+ return getattr(obj, self.attname)
else:
- return self.get_default()
+ return self.get_default()
def flatten_data(self, follow, obj=None):
"""
@@ -577,7 +577,7 @@ class FileField(Field):
dispatcher.connect(self.delete_file, signal=signals.post_delete, sender=cls)
def delete_file(self, instance):
- if getattr(instance, self.attname):
+ if getattr(instance, self.attname):
file_name = getattr(instance, 'get_%s_filename' % self.name)()
# If the file exists and no other object of this type references it,
# delete it from the filesystem.
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index ad7e0a605c..692c02b48a 100644
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
@@ -539,7 +539,7 @@ class OneToOneField(RelatedField, IntegerField):
def contribute_to_related_class(self, cls, related):
setattr(cls, related.get_accessor_name(), SingleRelatedObjectDescriptor(related))
if not cls._meta.one_to_one_field:
- cls._meta.one_to_one_field = self
+ cls._meta.one_to_one_field = self
class ManyToManyField(RelatedField, Field):
def __init__(self, to, **kwargs):
@@ -613,16 +613,16 @@ class ManyToManyField(RelatedField, Field):
if obj:
instance_ids = [instance._get_pk_val() for instance in getattr(obj, self.name).all()]
if self.rel.raw_id_admin:
- new_data[self.name] = ",".join([str(id) for id in instance_ids])
+ new_data[self.name] = ",".join([str(id) for id in instance_ids])
else:
- new_data[self.name] = instance_ids
+ new_data[self.name] = instance_ids
else:
# In required many-to-many fields with only one available choice,
# select that one available choice.
if not self.blank and not self.rel.edit_inline and not self.rel.raw_id_admin:
- choices_list = self.get_choices_default()
- if len(choices_list) == 1:
- new_data[self.name] = [choices_list[0][0]]
+ choices_list = self.get_choices_default()
+ if len(choices_list) == 1:
+ new_data[self.name] = [choices_list[0][0]]
return new_data
def contribute_to_class(self, cls, name):
diff --git a/django/db/models/options.py b/django/db/models/options.py
index b318599fcc..d1f5eeb756 100644
--- a/django/db/models/options.py
+++ b/django/db/models/options.py
@@ -239,7 +239,7 @@ class AdminFieldSet(object):
self.description = description
def __repr__(self):
- return "FieldSet: (%s, %s)" % (self.name, self.field_lines)
+ return "FieldSet: (%s, %s)" % (self.name, self.field_lines)
def bind(self, field_mapping, original, bound_field_set_class):
return bound_field_set_class(self, field_mapping, original)
diff --git a/django/db/models/related.py b/django/db/models/related.py
index 2f1fff9d29..4ab8cde5e7 100644
--- a/django/db/models/related.py
+++ b/django/db/models/related.py
@@ -52,9 +52,9 @@ class RelatedObject(object):
count = len(objects) + self.field.rel.num_extra_on_change
if self.field.rel.min_num_in_admin:
- count = max(count, self.field.rel.min_num_in_admin)
+ count = max(count, self.field.rel.min_num_in_admin)
if self.field.rel.max_num_in_admin:
- count = min(count, self.field.rel.max_num_in_admin)
+ count = min(count, self.field.rel.max_num_in_admin)
change = count - len(objects)
if change > 0:
diff --git a/django/forms/__init__.py b/django/forms/__init__.py
index b54351fd80..b0c1c2004f 100644
--- a/django/forms/__init__.py
+++ b/django/forms/__init__.py
@@ -327,10 +327,10 @@ class FormField:
new_data.setlist(name, converted_data)
else:
try:
- #individual fields deal with None values themselves
- new_data.setlist(name, [self.__class__.html2python(None)])
+ #individual fields deal with None values themselves
+ new_data.setlist(name, [self.__class__.html2python(None)])
except EmptyValue:
- new_data.setlist(name, [])
+ new_data.setlist(name, [])
def run_validator(self, new_data, validator):
@@ -348,7 +348,7 @@ class FormField:
try:
for validator in self.validator_list:
try:
- self.run_validator(new_data, validator)
+ self.run_validator(new_data, validator)
except validators.ValidationError, e:
errors.setdefault(self.field_name, []).extend(e.messages)
# If a CriticalValidationError is raised, ignore any other ValidationErrors
diff --git a/django/template/__init__.py b/django/template/__init__.py
index 3ec5cc09f8..e32200cccb 100644
--- a/django/template/__init__.py
+++ b/django/template/__init__.py
@@ -198,7 +198,7 @@ class DebugLexer(Lexer):
upto = end
last_bit = self.template_string[upto:]
if last_bit:
- token_tups.append( (last_bit, (upto, upto + len(last_bit))) )
+ token_tups.append( (last_bit, (upto, upto + len(last_bit))) )
return [self.create_token(tok, (self.origin, loc)) for tok, loc in token_tups]
def create_token(self, token_string, source):
@@ -245,7 +245,7 @@ class Parser(object):
compiled_result = compile_func(self, token)
except TemplateSyntaxError, e:
if not self.compile_function_error(token, e):
- raise
+ raise
self.extend_nodelist(nodelist, compiled_result, token)
self.exit_command()
if parse_until:
@@ -731,7 +731,7 @@ class VariableNode(Node):
class DebugVariableNode(VariableNode):
def render(self, context):
try:
- output = self.filter_expression.resolve(context)
+ output = self.filter_expression.resolve(context)
except TemplateSyntaxError, e:
if not hasattr(e, 'source'):
e.source = self.source
diff --git a/django/template/loader_tags.py b/django/template/loader_tags.py
index c2646038e1..e0d9a70a98 100644
--- a/django/template/loader_tags.py
+++ b/django/template/loader_tags.py
@@ -86,7 +86,7 @@ class ConstantIncludeNode(Node):
self.template = t
except:
if settings.TEMPLATE_DEBUG:
- raise
+ raise
self.template = None
def render(self, context):
@@ -100,16 +100,16 @@ class IncludeNode(Node):
self.template_name = template_name
def render(self, context):
- try:
- template_name = resolve_variable(self.template_name, context)
- t = get_template(template_name)
- return t.render(context)
- except TemplateSyntaxError, e:
- if settings.TEMPLATE_DEBUG:
+ try:
+ template_name = resolve_variable(self.template_name, context)
+ t = get_template(template_name)
+ return t.render(context)
+ except TemplateSyntaxError, e:
+ if settings.TEMPLATE_DEBUG:
raise
- return ''
- except:
- return '' # Fail silently for invalid included templates.
+ return ''
+ except:
+ return '' # Fail silently for invalid included templates.
def do_block(parser, token):
"""
diff --git a/django/utils/functional.py b/django/utils/functional.py
index 69aeb81850..d1514d5728 100644
--- a/django/utils/functional.py
+++ b/django/utils/functional.py
@@ -24,14 +24,14 @@ def lazy(func, *resultclasses):
# the evaluation and store the result. Afterwards, the result
# is delivered directly. So the result is memoized.
def __init__(self, args, kw):
- self.__func = func
- self.__args = args
- self.__kw = kw
- self.__dispatch = {}
- for resultclass in resultclasses:
- self.__dispatch[resultclass] = {}
- for (k, v) in resultclass.__dict__.items():
- setattr(self, k, self.__promise__(resultclass, k, v))
+ self.__func = func
+ self.__args = args
+ self.__kw = kw
+ self.__dispatch = {}
+ for resultclass in resultclasses:
+ self.__dispatch[resultclass] = {}
+ for (k, v) in resultclass.__dict__.items():
+ setattr(self, k, self.__promise__(resultclass, k, v))
def __promise__(self, klass, funcname, func):
# Builds a wrapper around some magic method and registers that magic