diff options
| author | Loic Bistuer <loic.bistuer@sixmedia.com> | 2013-12-09 00:20:06 +0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-12-10 15:12:48 -0500 |
| commit | a2814846ca006b4fbf3a893ec52cd9d444b3a3eb (patch) | |
| tree | 780498814e830e2b8ee6ac435575afdc2e8e63f6 /django | |
| parent | 0873200e7f61315ad375061a3dc6d37b514ff985 (diff) | |
Fixed E124 pep8 warnings.
Diffstat (limited to 'django')
26 files changed, 163 insertions, 138 deletions
diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py index a2a7df945a..318c393c09 100644 --- a/django/contrib/admin/helpers.py +++ b/django/contrib/admin/helpers.py @@ -42,7 +42,8 @@ class AdminForm(object): def __iter__(self): for name, options in self.fieldsets: - yield Fieldset(self.form, name, + yield Fieldset( + self.form, name, readonly_fields=self.readonly_fields, model_admin=self.model_admin, **options diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 51e8a1b2e6..4c5adaf0f8 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -1520,7 +1520,8 @@ class ModelAdmin(BaseModelAdmin): selection_note_all = ungettext('%(total_count)s selected', 'All %(total_count)s selected', cl.result_count) - context = dict(self.admin_site.each_context(), + context = dict( + self.admin_site.each_context(), module_name=force_text(opts.verbose_name_plural), selection_note=_('0 of %(cnt)s selected') % {'cnt': len(cl.result_list)}, selection_note_all=selection_note_all % {'total_count': cl.result_count}, @@ -1587,7 +1588,8 @@ class ModelAdmin(BaseModelAdmin): else: title = _("Are you sure?") - context = dict(self.admin_site.each_context(), + context = dict( + self.admin_site.each_context(), title=title, object_name=object_name, object=obj, diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index e620154312..7b633bef89 100644 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -398,7 +398,8 @@ class AdminSite(object): for app in app_list: app['models'].sort(key=lambda x: x['name']) - context = dict(self.each_context(), + context = dict( + self.each_context(), title=self.index_title, app_list=app_list, ) diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index 777bfbac81..0181f665ad 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -95,7 +95,8 @@ def result_headers(cl): """ ordering_field_columns = cl.get_ordering_field_columns() for i, field_name in enumerate(cl.list_display): - text, attr = label_for_field(field_name, cl.model, + text, attr = label_for_field( + field_name, cl.model, model_admin=cl.model_admin, return_attr=True ) diff --git a/django/contrib/admindocs/tests/test_fields.py b/django/contrib/admindocs/tests/test_fields.py index dd465111a1..3f4efedb9c 100644 --- a/django/contrib/admindocs/tests/test_fields.py +++ b/django/contrib/admindocs/tests/test_fields.py @@ -21,7 +21,8 @@ class TestFieldType(unittest.TestCase): pass def test_field_name(self): - self.assertRaises(AttributeError, + self.assertRaises( + AttributeError, views.get_readable_field_data_type, "NotAField" ) diff --git a/django/contrib/admindocs/urls.py b/django/contrib/admindocs/urls.py index 8aa4dcf946..3dc55657df 100644 --- a/django/contrib/admindocs/urls.py +++ b/django/contrib/admindocs/urls.py @@ -4,38 +4,29 @@ from django.contrib.admindocs import views urlpatterns = patterns('', url('^$', views.BaseAdminDocsView.as_view(template_name='admin_doc/index.html'), - name='django-admindocs-docroot' - ), + name='django-admindocs-docroot'), url('^bookmarklets/$', views.BookmarkletsView.as_view(), - name='django-admindocs-bookmarklets' - ), + name='django-admindocs-bookmarklets'), url('^tags/$', views.TemplateTagIndexView.as_view(), - name='django-admindocs-tags' - ), + name='django-admindocs-tags'), url('^filters/$', views.TemplateFilterIndexView.as_view(), - name='django-admindocs-filters' - ), + name='django-admindocs-filters'), url('^views/$', views.ViewIndexView.as_view(), - name='django-admindocs-views-index' - ), + name='django-admindocs-views-index'), url('^views/(?P<view>[^/]+)/$', views.ViewDetailView.as_view(), - name='django-admindocs-views-detail' - ), + name='django-admindocs-views-detail'), url('^models/$', views.ModelIndexView.as_view(), - name='django-admindocs-models-index' - ), + name='django-admindocs-models-index'), url('^models/(?P<app_label>[^\.]+)\.(?P<model_name>[^/]+)/$', views.ModelDetailView.as_view(), - name='django-admindocs-models-detail' - ), + name='django-admindocs-models-detail'), url('^templates/(?P<template>.*)/$', views.TemplateDetailView.as_view(), - name='django-admindocs-templates' - ), + name='django-admindocs-templates'), ) diff --git a/django/contrib/auth/admin.py b/django/contrib/auth/admin.py index 8514f3bfcf..9bfc070ab2 100644 --- a/django/contrib/auth/admin.py +++ b/django/contrib/auth/admin.py @@ -48,8 +48,8 @@ class UserAdmin(admin.ModelAdmin): add_fieldsets = ( (None, { 'classes': ('wide',), - 'fields': ('username', 'password1', 'password2')} - ), + 'fields': ('username', 'password1', 'password2'), + }), ) form = UserChangeForm add_form = UserCreationForm diff --git a/django/contrib/auth/tests/test_basic.py b/django/contrib/auth/tests/test_basic.py index e5a3e676b8..34b6142632 100644 --- a/django/contrib/auth/tests/test_basic.py +++ b/django/contrib/auth/tests/test_basic.py @@ -130,7 +130,8 @@ class BasicTestCase(TestCase): "Check the operation of the createsuperuser management command" # We can use the management command to create a superuser new_io = StringIO() - call_command("createsuperuser", + call_command( + "createsuperuser", interactive=False, username="joe", email="joe@somewhere.org", @@ -146,7 +147,8 @@ class BasicTestCase(TestCase): # We can supress output on the management command new_io = StringIO() - call_command("createsuperuser", + call_command( + "createsuperuser", interactive=False, username="joe2", email="joe2@somewhere.org", @@ -159,7 +161,8 @@ class BasicTestCase(TestCase): self.assertEqual(u.email, 'joe2@somewhere.org') self.assertFalse(u.has_usable_password()) - call_command("createsuperuser", + call_command( + "createsuperuser", interactive=False, username="joe+admin@somewhere.org", email="joe@somewhere.org", @@ -182,7 +185,8 @@ class BasicTestCase(TestCase): locale.getdefaultlocale = lambda: (None, None) # Call the command in this new environment - call_command("createsuperuser", + call_command( + "createsuperuser", interactive=True, username="nolocale@somewhere.org", email="nolocale@somewhere.org", @@ -212,7 +216,8 @@ class BasicTestCase(TestCase): username_field.verbose_name = ulazy('uživatel') new_io = StringIO() try: - call_command("createsuperuser", + call_command( + "createsuperuser", interactive=True, stdout=new_io ) diff --git a/django/contrib/auth/tests/test_management.py b/django/contrib/auth/tests/test_management.py index 795b72b52e..bd51f39977 100644 --- a/django/contrib/auth/tests/test_management.py +++ b/django/contrib/auth/tests/test_management.py @@ -91,7 +91,8 @@ class CreatesuperuserManagementCommandTestCase(TestCase): "Check the operation of the createsuperuser management command" # We can use the management command to create a superuser new_io = StringIO() - call_command("createsuperuser", + call_command( + "createsuperuser", interactive=False, username="joe", email="joe@somewhere.org", @@ -108,7 +109,8 @@ class CreatesuperuserManagementCommandTestCase(TestCase): def test_verbosity_zero(self): # We can supress output on the management command new_io = StringIO() - call_command("createsuperuser", + call_command( + "createsuperuser", interactive=False, username="joe2", email="joe2@somewhere.org", @@ -123,7 +125,8 @@ class CreatesuperuserManagementCommandTestCase(TestCase): def test_email_in_username(self): new_io = StringIO() - call_command("createsuperuser", + call_command( + "createsuperuser", interactive=False, username="joe+admin@somewhere.org", email="joe@somewhere.org", @@ -140,7 +143,8 @@ class CreatesuperuserManagementCommandTestCase(TestCase): # We skip validation because the temporary substitution of the # swappable User model messes with validation. new_io = StringIO() - call_command("createsuperuser", + call_command( + "createsuperuser", interactive=False, email="joe@somewhere.org", date_of_birth="1976-04-01", @@ -163,7 +167,8 @@ class CreatesuperuserManagementCommandTestCase(TestCase): # swappable User model messes with validation. new_io = StringIO() with self.assertRaises(CommandError): - call_command("createsuperuser", + call_command( + "createsuperuser", interactive=False, username="joe@somewhere.org", stdout=new_io, diff --git a/django/contrib/contenttypes/generic.py b/django/contrib/contenttypes/generic.py index 9ef499bb16..1ec5475f5b 100644 --- a/django/contrib/contenttypes/generic.py +++ b/django/contrib/contenttypes/generic.py @@ -452,9 +452,10 @@ class BaseGenericInlineFormSet(BaseModelFormSet): @classmethod def get_default_prefix(cls): opts = cls.model._meta - return '-'.join((opts.app_label, opts.model_name, - cls.ct_field.name, cls.ct_fk_field.name, - )) + return '-'.join( + (opts.app_label, opts.model_name, + cls.ct_field.name, cls.ct_fk_field.name) + ) def save_new(self, form, commit=True): setattr(form.instance, self.ct_field.get_attname(), diff --git a/django/contrib/gis/db/models/query.py b/django/contrib/gis/db/models/query.py index cdff5396cc..66b96a0873 100644 --- a/django/contrib/gis/db/models/query.py +++ b/django/contrib/gis/db/models/query.py @@ -362,12 +362,14 @@ class GeoQuerySet(QuerySet): relative = int(bool(relative)) if not isinstance(precision, six.integer_types): raise TypeError('SVG precision keyword argument must be an integer.') - s = {'desc': 'SVG', - 'procedure_fmt': '%(geo_col)s,%(rel)s,%(precision)s', - 'procedure_args': {'rel': relative, - 'precision': precision, - } - } + s = { + 'desc': 'SVG', + 'procedure_fmt': '%(geo_col)s,%(rel)s,%(precision)s', + 'procedure_args': { + 'rel': relative, + 'precision': precision, + } + } return self._spatial_attribute('svg', s, **kwargs) def sym_difference(self, geom, **kwargs): @@ -746,11 +748,12 @@ class GeoQuerySet(QuerySet): for geometry set-like operations (e.g., intersection, difference, union, sym_difference). """ - s = {'geom_args': ('geom',), - 'select_field': GeomField(), - 'procedure_fmt': '%(geo_col)s,%(geom)s', - 'procedure_args': {'geom': geom}, - } + s = { + 'geom_args': ('geom',), + 'select_field': GeomField(), + 'procedure_fmt': '%(geo_col)s,%(geom)s', + 'procedure_args': {'geom': geom}, + } if connections[self.db].ops.oracle: s['procedure_fmt'] += ',%(tolerance)s' s['procedure_args']['tolerance'] = tolerance diff --git a/django/contrib/gis/forms/widgets.py b/django/contrib/gis/forms/widgets.py index 2609ac16fd..60041cd75f 100644 --- a/django/contrib/gis/forms/widgets.py +++ b/django/contrib/gis/forms/widgets.py @@ -66,7 +66,8 @@ class BaseGeometryWidget(Widget): value.srid, self.map_srid, err) ) - context = self.build_attrs(attrs, + context = self.build_attrs( + attrs, name=name, module='geodjango_%s' % name.replace('-', '_'), # JS-safe serialized=self.serialize(value), diff --git a/django/contrib/gis/tests/geoapp/test_regress.py b/django/contrib/gis/tests/geoapp/test_regress.py index 3bd74b00d1..5fd74ea997 100644 --- a/django/contrib/gis/tests/geoapp/test_regress.py +++ b/django/contrib/gis/tests/geoapp/test_regress.py @@ -33,10 +33,11 @@ class GeoRegressionTests(TestCase): def test_kmz(self): "Testing `render_to_kmz` with non-ASCII data. See #11624." name = "Åland Islands" - places = [{'name': name, - 'description': name, - 'kml': '<Point><coordinates>5.0,23.0</coordinates></Point>' - }] + places = [{ + 'name': name, + 'description': name, + 'kml': '<Point><coordinates>5.0,23.0</coordinates></Point>' + }] render_to_kmz('gis/kml/placemarks.kml', {'places': places}) @no_spatialite diff --git a/django/core/management/commands/testserver.py b/django/core/management/commands/testserver.py index 182587b0f5..79f0ff5501 100644 --- a/django/core/management/commands/testserver.py +++ b/django/core/management/commands/testserver.py @@ -37,7 +37,8 @@ class Command(BaseCommand): # multiple times. shutdown_message = '\nServer stopped.\nNote that the test database, %r, has not been deleted. You can explore it on your own.' % db_name use_threading = connection.features.test_db_allows_multiple_connections - call_command('runserver', + call_command( + 'runserver', addrport=addrport, shutdown_message=shutdown_message, use_reloader=False, diff --git a/django/core/management/validation.py b/django/core/management/validation.py index 5bf9413c20..6bdcf853d4 100644 --- a/django/core/management/validation.py +++ b/django/core/management/validation.py @@ -270,8 +270,7 @@ def get_validation_errors(outfile, app=None): seen_to = True if f.rel.through not in models.get_models(include_auto_created=True): e.add(opts, "'%s' specifies an m2m relation through model " - "%s, which has not been installed." % (f.name, f.rel.through) - ) + "%s, which has not been installed." % (f.name, f.rel.through)) signature = (f.rel.to, cls, f.rel.through) if signature in seen_intermediary_signatures: e.add(opts, "The model %s has two manually-defined m2m " @@ -295,13 +294,14 @@ def get_validation_errors(outfile, app=None): if not seen_related_fk or not seen_this_fk: e.add(opts, "'%s' is a manually-defined m2m relation " "through model %s, which does not have foreign keys " - "to %s and %s" % (f.name, f.rel.through._meta.object_name, - f.rel.to._meta.object_name, cls._meta.object_name) + "to %s and %s" % ( + f.name, f.rel.through._meta.object_name, + f.rel.to._meta.object_name, cls._meta.object_name + ) ) elif isinstance(f.rel.through, six.string_types): e.add(opts, "'%s' specifies an m2m relation through model %s, " - "which has not been installed" % (f.name, f.rel.through) - ) + "which has not been installed" % (f.name, f.rel.through)) rel_opts = f.rel.to._meta rel_name = f.related.get_accessor_name() diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index a2a1757ad3..3faaeffb21 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -1215,8 +1215,7 @@ class BaseDatabaseOperations(object): # Structure returned by the DB-API cursor.description interface (PEP 249) FieldInfo = namedtuple('FieldInfo', - 'name type_code display_size internal_size precision scale null_ok' -) + 'name type_code display_size internal_size precision scale null_ok') class BaseDatabaseIntrospection(object): diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index b38d00c84a..e7932dd800 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -332,13 +332,15 @@ class DatabaseOperations(BaseDatabaseOperations): # Truncate already resets the AUTO_INCREMENT field from # MySQL version 5.0.13 onwards. Refs #16961. if self.connection.mysql_version < (5, 0, 13): - return ["%s %s %s %s %s;" % - (style.SQL_KEYWORD('ALTER'), + return [ + "%s %s %s %s %s;" % ( + style.SQL_KEYWORD('ALTER'), style.SQL_KEYWORD('TABLE'), style.SQL_TABLE(self.quote_name(sequence['table'])), style.SQL_KEYWORD('AUTO_INCREMENT'), style.SQL_FIELD('= 1'), - ) for sequence in sequences] + ) for sequence in sequences + ] else: return [] diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py index cb23c33a5c..91e16a1b76 100644 --- a/django/db/backends/postgresql_psycopg2/base.py +++ b/django/db/backends/postgresql_psycopg2/base.py @@ -168,7 +168,8 @@ class DatabaseWrapper(BaseDatabaseWrapper): # notification. If we don't set self.connection to None, the error # will occur a every request. self.connection = None - logger.warning('psycopg2 error while closing the connection.', + logger.warning( + 'psycopg2 error while closing the connection.', exc_info=sys.exc_info() ) raise diff --git a/django/db/migrations/optimizer.py b/django/db/migrations/optimizer.py index 435ac6766e..3e9dc42aa3 100644 --- a/django/db/migrations/optimizer.py +++ b/django/db/migrations/optimizer.py @@ -176,12 +176,14 @@ class MigrationOptimizer(object): Folds a model rename into its create """ if operation.name.lower() == other.old_name.lower(): - return [migrations.CreateModel( - other.new_name, - fields=operation.fields, - options=operation.options, - bases=operation.bases, - )] + return [ + migrations.CreateModel( + other.new_name, + fields=operation.fields, + options=operation.options, + bases=operation.bases, + ) + ] def reduce_model_rename_self(self, operation, other): """ @@ -197,57 +199,67 @@ class MigrationOptimizer(object): def reduce_create_model_add_field(self, operation, other): if operation.name.lower() == other.model_name.lower(): - return [migrations.CreateModel( - operation.name, - fields=operation.fields + [(other.name, other.field)], - options=operation.options, - bases=operation.bases, - )] + return [ + migrations.CreateModel( + operation.name, + fields=operation.fields + [(other.name, other.field)], + options=operation.options, + bases=operation.bases, + ) + ] def reduce_create_model_alter_field(self, operation, other): if operation.name.lower() == other.model_name.lower(): - return [migrations.CreateModel( - operation.name, - fields=[ - (n, other.field if n == other.name else v) - for n, v in operation.fields - ], - options=operation.options, - bases=operation.bases, - )] + return [ + migrations.CreateModel( + operation.name, + fields=[ + (n, other.field if n == other.name else v) + for n, v in operation.fields + ], + options=operation.options, + bases=operation.bases, + ) + ] def reduce_create_model_rename_field(self, operation, other): if operation.name.lower() == other.model_name.lower(): - return [migrations.CreateModel( - operation.name, - fields=[ - (other.new_name if n == other.old_name else n, v) - for n, v in operation.fields - ], - options=operation.options, - bases=operation.bases, - )] + return [ + migrations.CreateModel( + operation.name, + fields=[ + (other.new_name if n == other.old_name else n, v) + for n, v in operation.fields + ], + options=operation.options, + bases=operation.bases, + ) + ] def reduce_create_model_remove_field(self, operation, other): if operation.name.lower() == other.model_name.lower(): - return [migrations.CreateModel( - operation.name, - fields=[ - (n, v) - for n, v in operation.fields - if n.lower() != other.name.lower() - ], - options=operation.options, - bases=operation.bases, - )] + return [ + migrations.CreateModel( + operation.name, + fields=[ + (n, v) + for n, v in operation.fields + if n.lower() != other.name.lower() + ], + options=operation.options, + bases=operation.bases, + ) + ] def reduce_add_field_alter_field(self, operation, other): if operation.model_name.lower() == other.model_name.lower() and operation.name.lower() == other.name.lower(): - return [migrations.AddField( - model_name=operation.model_name, - name=operation.name, - field=other.field, - )] + return [ + migrations.AddField( + model_name=operation.model_name, + name=operation.name, + field=other.field, + ) + ] def reduce_add_field_delete_field(self, operation, other): if operation.model_name.lower() == other.model_name.lower() and operation.name.lower() == other.name.lower(): @@ -259,11 +271,13 @@ class MigrationOptimizer(object): def reduce_add_field_rename_field(self, operation, other): if operation.model_name.lower() == other.model_name.lower() and operation.name.lower() == other.old_name.lower(): - return [migrations.AddField( - model_name=operation.model_name, - name=other.new_name, - field=operation.field, - )] + return [ + migrations.AddField( + model_name=operation.model_name, + name=other.new_name, + field=operation.field, + ) + ] def reduce_alter_field_rename_field(self, operation, other): if operation.model_name.lower() == other.model_name.lower() and operation.name.lower() == other.old_name.lower(): diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 826471d9ed..fbdf67d4c5 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -1686,8 +1686,7 @@ class BinaryField(Field): return default def get_db_prep_value(self, value, connection, prepared=False): - value = super(BinaryField, self - ).get_db_prep_value(value, connection, prepared) + value = super(BinaryField, self).get_db_prep_value(value, connection, prepared) if value is not None: return connection.Database.Binary(value) return value diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index be796f2af1..5bfb1022a8 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -963,8 +963,7 @@ class OneToOneRel(ManyToOneRel): parent_link=False, on_delete=None, related_query_name=None): super(OneToOneRel, self).__init__(field, to, field_name, related_name=related_name, limit_choices_to=limit_choices_to, - parent_link=parent_link, on_delete=on_delete, related_query_name=related_query_name, - ) + parent_link=parent_link, on_delete=on_delete, related_query_name=related_query_name) self.multiple = False diff --git a/django/forms/utils.py b/django/forms/utils.py index 85297b1a1e..9402f2612e 100644 --- a/django/forms/utils.py +++ b/django/forms/utils.py @@ -52,11 +52,10 @@ class ErrorDict(dict): def as_ul(self): if not self: return '' - return format_html('<ul class="errorlist">{0}</ul>', - format_html_join('', '<li>{0}{1}</li>', - ((k, force_text(v)) - for k, v in self.items()) - )) + return format_html( + '<ul class="errorlist">{0}</ul>', + format_html_join('', '<li>{0}{1}</li>', ((k, force_text(v)) for k, v in self.items())) + ) def as_text(self): return '\n'.join('* %s\n%s' % (k, '\n'.join(' * %s' % force_text(i) for i in v)) for k, v in self.items()) @@ -73,11 +72,10 @@ class ErrorList(list): def as_ul(self): if not self: return '' - return format_html('<ul class="errorlist">{0}</ul>', - format_html_join('', '<li>{0}</li>', - ((force_text(e),) for e in self) - ) - ) + return format_html( + '<ul class="errorlist">{0}</ul>', + format_html_join('', '<li>{0}</li>', ((force_text(e),) for e in self)) + ) def as_text(self): if not self: diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 79f3961138..aeb674d013 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -72,7 +72,7 @@ class Media(object): return path if prefix is None: if settings.STATIC_URL is None: - # backwards compatibility + # backwards compatibility prefix = settings.MEDIA_URL else: prefix = settings.STATIC_URL diff --git a/django/test/__init__.py b/django/test/__init__.py index 98ff4393a3..4b17ed18c9 100644 --- a/django/test/__init__.py +++ b/django/test/__init__.py @@ -3,7 +3,8 @@ Django Unit Test and Doctest framework. """ from django.test.client import Client, RequestFactory -from django.test.testcases import (TestCase, TransactionTestCase, +from django.test.testcases import ( + TestCase, TransactionTestCase, SimpleTestCase, LiveServerTestCase, skipIfDBFeature, skipUnlessDBFeature ) diff --git a/django/test/simple.py b/django/test/simple.py index 05a7329fae..73deef917b 100644 --- a/django/test/simple.py +++ b/django/test/simple.py @@ -123,8 +123,7 @@ def get_tests(app_module): def make_doctest(module): return doctest.DocTestSuite(module, checker=doctestOutputChecker, - runner=DocTestRunner, - ) + runner=DocTestRunner) def build_suite(app_module): diff --git a/django/utils/text.py b/django/utils/text.py index b29e125f03..5e812b4f19 100644 --- a/django/utils/text.py +++ b/django/utils/text.py @@ -268,8 +268,7 @@ def phone2numeric(phone): char2number = {'a': '2', 'b': '2', 'c': '2', 'd': '3', 'e': '3', 'f': '3', 'g': '4', 'h': '4', 'i': '4', 'j': '5', 'k': '5', 'l': '5', 'm': '6', 'n': '6', 'o': '6', 'p': '7', 'q': '7', 'r': '7', 's': '7', 't': '8', - 'u': '8', 'v': '8', 'w': '9', 'x': '9', 'y': '9', 'z': '9', - } + 'u': '8', 'v': '8', 'w': '9', 'x': '9', 'y': '9', 'z': '9'} return ''.join(char2number.get(c, c) for c in phone.lower()) phone2numeric = allow_lazy(phone2numeric) |
