Permalink
Browse files

Fixed #17627 -- Renamed util.py files to utils.py

Thanks PaulM for the suggestion and Luke Granger-Brown and
Wiktor Kołodziej for the initial patch.
  • Loading branch information...
1 parent 8d29005 commit 18ffdb1772ba60e085cff8fd9a1d4a7b129b4032 @timgraham timgraham committed Sep 16, 2013
Showing with 111 additions and 84 deletions.
  1. +2 −0 AUTHORS
  2. +1 −1 django/contrib/admin/actions.py
  3. +1 −1 django/contrib/admin/filters.py
  4. +3 −3 django/contrib/admin/helpers.py
  5. +1 −1 django/contrib/admin/models.py
  6. +1 −1 django/contrib/admin/options.py
  7. +1 −1 django/contrib/admin/templatetags/admin_list.py
  8. +1 −1 django/contrib/admin/templatetags/admin_urls.py
  9. 0 django/contrib/admin/{util.py → utils.py}
  10. +1 −1 django/contrib/admin/validation.py
  11. +1 −1 django/contrib/admin/views/main.py
  12. +1 −1 django/contrib/admin/widgets.py
  13. +1 −1 django/contrib/auth/forms.py
  14. +1 −1 django/contrib/comments/forms.py
  15. +1 −1 django/contrib/gis/db/backends/oracle/creation.py
  16. +1 −1 django/contrib/gis/db/backends/oracle/operations.py
  17. +1 −1 django/contrib/gis/db/backends/postgis/operations.py
  18. +1 −1 django/contrib/gis/db/backends/spatialite/operations.py
  19. 0 django/contrib/gis/db/backends/{util.py → utils.py}
  20. +1 −1 django/contrib/gis/db/models/sql/compiler.py
  21. +4 −4 django/db/backends/__init__.py
  22. +1 −1 django/db/backends/creation.py
  23. +5 −5 django/db/backends/mysql/base.py
  24. +1 −1 django/db/backends/mysql/creation.py
  25. +6 −5 django/db/backends/oracle/base.py
  26. +1 −1 django/db/backends/postgresql_psycopg2/creation.py
  27. +1 −1 django/db/backends/schema.py
  28. +9 −9 django/db/backends/sqlite3/base.py
  29. 0 django/db/backends/{util.py → utils.py}
  30. +3 −3 django/db/models/fields/__init__.py
  31. +2 −2 django/db/models/fields/related.py
  32. +1 −1 django/db/models/options.py
  33. +2 −2 django/db/models/query_utils.py
  34. +3 −3 django/db/models/sql/compiler.py
  35. +1 −1 django/forms/fields.py
  36. +1 −1 django/forms/forms.py
  37. +1 −1 django/forms/formsets.py
  38. +1 −1 django/forms/models.py
  39. 0 django/forms/{util.py → utils.py}
  40. +1 −1 django/forms/widgets.py
  41. +9 −0 docs/internals/deprecation.txt
  42. +6 −2 docs/ref/forms/api.txt
  43. +2 −2 docs/ref/forms/validation.txt
  44. +11 −0 docs/releases/1.7.txt
  45. +1 −1 docs/topics/forms/formsets.txt
  46. +1 −1 tests/admin_custom_urls/tests.py
  47. +1 −1 tests/admin_util/tests.py
  48. +1 −1 tests/admin_views/admin.py
  49. +2 −2 tests/admin_views/tests.py
  50. +1 −1 tests/backends/tests.py
  51. +1 −1 tests/db_typecasts/tests.py
  52. +1 −1 tests/forms_tests/tests/test_error_messages.py
  53. +1 −1 tests/forms_tests/tests/test_extra.py
  54. +3 −3 tests/forms_tests/tests/test_fields.py
  55. +1 −1 tests/forms_tests/tests/test_formsets.py
  56. +2 −2 tests/forms_tests/tests/test_util.py
  57. +1 −1 tests/model_formsets_regress/tests.py
  58. +1 −1 tests/proxy_models/tests.py
View
@@ -264,6 +264,7 @@ answer newbie questions, and generally made Django that much better:
David Gouldin <dgouldin@gmail.com>
pradeep.gowda@gmail.com
Collin Grady <collin@collingrady.com>
+ Luke Granger-Brown <django@lukegb.com>
Gabriel Grant <g@briel.ca>
Martin Green
Daniel Greenfeld
@@ -348,6 +349,7 @@ answer newbie questions, and generally made Django that much better:
Cameron Knight (ckknight)
Nena Kojadin <nena@kiberpipa.org>
Igor Kolar <ike@email.si>
+ Wiktor Kołodziej
Tomáš Kopeček <permonik@m6.cz>
Gasper Koren
Mikhail Korobov <kmike84@googlemail.com>
@@ -5,7 +5,7 @@
from django.core.exceptions import PermissionDenied
from django.contrib import messages
from django.contrib.admin import helpers
-from django.contrib.admin.util import get_deleted_objects, model_ngettext
+from django.contrib.admin.utils import get_deleted_objects, model_ngettext
from django.db import router
from django.template.response import TemplateResponse
from django.utils.encoding import force_text
@@ -12,7 +12,7 @@
from django.utils.encoding import smart_text, force_text
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
-from django.contrib.admin.util import (get_model_from_relation,
+from django.contrib.admin.utils import (get_model_from_relation,
reverse_field_path, get_limit_choices_to_from_path, prepare_lookup_value)
from django.contrib.admin.options import IncorrectLookupParameters
@@ -1,13 +1,13 @@
from __future__ import unicode_literals
from django import forms
-from django.contrib.admin.util import (flatten_fieldsets, lookup_field,
+from django.contrib.admin.utils import (flatten_fieldsets, lookup_field,
display_for_field, label_for_field, help_text_for_field)
from django.contrib.admin.templatetags.admin_static import static
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.fields.related import ManyToManyRel
-from django.forms.util import flatatt
+from django.forms.utils import flatatt
from django.template.defaultfilters import capfirst
from django.utils.encoding import force_text, smart_text
from django.utils.html import conditional_escape, format_html
@@ -308,7 +308,7 @@ def __iter__(self):
yield Fieldline(self.form, field, self.readonly_fields,
model_admin=self.model_admin)
-class AdminErrorList(forms.util.ErrorList):
+class AdminErrorList(forms.utils.ErrorList):
"""
Stores all errors for the form/formsets in an add/change stage view.
"""
@@ -3,7 +3,7 @@
from django.db import models
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
-from django.contrib.admin.util import quote
+from django.contrib.admin.utils import quote
from django.core.urlresolvers import reverse, NoReverseMatch
from django.utils.translation import ugettext, ugettext_lazy as _
from django.utils.encoding import smart_text
@@ -8,7 +8,7 @@
from django.conf import settings
from django.contrib import messages
from django.contrib.admin import widgets, helpers
-from django.contrib.admin.util import (unquote, flatten_fieldsets, get_deleted_objects,
+from django.contrib.admin.utils import (unquote, flatten_fieldsets, get_deleted_objects,
model_format_dict, NestedObjects, lookup_needs_distinct)
from django.contrib.admin import validation
from django.contrib.admin.templatetags.admin_static import static
@@ -3,7 +3,7 @@
import datetime
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
-from django.contrib.admin.util import (lookup_field, display_for_field,
+from django.contrib.admin.utils import (lookup_field, display_for_field,
display_for_value, label_for_field)
from django.contrib.admin.views.main import (ALL_VAR, EMPTY_CHANGELIST_VALUE,
ORDER_VAR, PAGE_VAR, SEARCH_VAR)
@@ -4,7 +4,7 @@
from urlparse import parse_qsl, urlparse, urlunparse
from django import template
-from django.contrib.admin.util import quote
+from django.contrib.admin.utils import quote
from django.core.urlresolvers import resolve, Resolver404
from django.utils.http import urlencode
File renamed without changes.
@@ -2,7 +2,7 @@
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.forms.models import BaseModelForm, BaseModelFormSet, _get_foreign_key
-from django.contrib.admin.util import get_fields_from_path, NotRelationField
+from django.contrib.admin.utils import get_fields_from_path, NotRelationField
"""
Does basic ModelAdmin option validation. Calls custom validation
@@ -16,7 +16,7 @@
from django.contrib.admin import FieldListFilter
from django.contrib.admin.exceptions import DisallowedModelAdminLookup
from django.contrib.admin.options import IncorrectLookupParameters, IS_POPUP_VAR, TO_FIELD_VAR
-from django.contrib.admin.util import (quote, get_fields_from_path,
+from django.contrib.admin.utils import (quote, get_fields_from_path,
lookup_needs_distinct, prepare_lookup_value)
# Changelist settings
@@ -9,7 +9,7 @@
from django.contrib.admin.templatetags.admin_static import static
from django.core.urlresolvers import reverse
from django.forms.widgets import RadioFieldRenderer
-from django.forms.util import flatatt
+from django.forms.utils import flatatt
from django.utils.html import escape, format_html, format_html_join, smart_urlquote
from django.utils.text import Truncator
from django.utils.translation import ugettext as _
@@ -3,7 +3,7 @@
from collections import OrderedDict
from django import forms
-from django.forms.util import flatatt
+from django.forms.utils import flatatt
from django.template import loader
from django.utils.encoding import force_bytes
from django.utils.html import format_html, format_html_join
@@ -1,6 +1,6 @@
import time
from django import forms
-from django.forms.util import ErrorDict
+from django.forms.utils import ErrorDict
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.comments.models import Comment
@@ -1,5 +1,5 @@
from django.db.backends.oracle.creation import DatabaseCreation
-from django.db.backends.util import truncate_name
+from django.db.backends.utils import truncate_name
class OracleCreation(DatabaseCreation):
@@ -13,7 +13,7 @@
from django.db.backends.oracle.base import DatabaseOperations
from django.contrib.gis.db.backends.base import BaseSpatialOperations
from django.contrib.gis.db.backends.oracle.adapter import OracleSpatialAdapter
-from django.contrib.gis.db.backends.util import SpatialFunction
+from django.contrib.gis.db.backends.utils import SpatialFunction
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Distance
from django.utils import six
@@ -3,7 +3,7 @@
from django.conf import settings
from django.contrib.gis.db.backends.base import BaseSpatialOperations
-from django.contrib.gis.db.backends.util import SpatialOperation, SpatialFunction
+from django.contrib.gis.db.backends.utils import SpatialOperation, SpatialFunction
from django.contrib.gis.db.backends.postgis.adapter import PostGISAdapter
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Distance
@@ -3,7 +3,7 @@
from decimal import Decimal
from django.contrib.gis.db.backends.base import BaseSpatialOperations
-from django.contrib.gis.db.backends.util import SpatialOperation, SpatialFunction
+from django.contrib.gis.db.backends.utils import SpatialOperation, SpatialFunction
from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.measure import Distance
@@ -1,7 +1,7 @@
import datetime
from django.conf import settings
-from django.db.backends.util import truncate_name, typecast_date, typecast_timestamp
+from django.db.backends.utils import truncate_name, typecast_date, typecast_timestamp
from django.db.models.sql import compiler
from django.db.models.sql.constants import MULTI
from django.utils import six
@@ -14,7 +14,7 @@
from django.conf import settings
from django.db import DEFAULT_DB_ALIAS
from django.db.backends.signals import connection_created
-from django.db.backends import util
+from django.db.backends import utils
from django.db.transaction import TransactionManagementError
from django.db.utils import DatabaseErrorWrapper
from django.utils.functional import cached_property
@@ -158,7 +158,7 @@ def cursor(self):
(self.use_debug_cursor is None and settings.DEBUG)):
cursor = self.make_debug_cursor(self._cursor())
else:
- cursor = util.CursorWrapper(self._cursor(), self)
+ cursor = utils.CursorWrapper(self._cursor(), self)
return cursor
def commit(self):
@@ -495,7 +495,7 @@ def make_debug_cursor(self, cursor):
"""
Creates a cursor that logs all queries in self.queries.
"""
- return util.CursorDebugWrapper(cursor, self)
+ return utils.CursorDebugWrapper(cursor, self)
@contextmanager
def temporary_connection(self):
@@ -1131,7 +1131,7 @@ def value_to_db_decimal(self, value, max_digits, decimal_places):
"""
if value is None:
return None
- return util.format_number(value, max_digits, decimal_places)
+ return utils.format_number(value, max_digits, decimal_places)
def year_lookup_bounds_for_date_field(self, value):
"""
@@ -8,7 +8,7 @@
from django.utils.encoding import force_bytes
from django.utils.six.moves import input
-from .util import truncate_name
+from .utils import truncate_name
# The prefix to put on the default database name when creating
# the test database.
@@ -37,7 +37,7 @@
from django.conf import settings
from django.db import utils
-from django.db.backends import (util, BaseDatabaseFeatures,
+from django.db.backends import (utils as backend_utils, BaseDatabaseFeatures,
BaseDatabaseOperations, BaseDatabaseWrapper)
from django.db.backends.mysql.client import DatabaseClient
from django.db.backends.mysql.creation import DatabaseCreation
@@ -91,9 +91,9 @@ def adapt_datetime_with_timezone_support(value, conv):
# timezone support is active, Django expects timezone-aware datetime objects.
django_conversions = conversions.copy()
django_conversions.update({
- FIELD_TYPE.TIME: util.typecast_time,
- FIELD_TYPE.DECIMAL: util.typecast_decimal,
- FIELD_TYPE.NEWDECIMAL: util.typecast_decimal,
+ FIELD_TYPE.TIME: backend_utils.typecast_time,
+ FIELD_TYPE.DECIMAL: backend_utils.typecast_decimal,
+ FIELD_TYPE.NEWDECIMAL: backend_utils.typecast_decimal,
FIELD_TYPE.DATETIME: parse_datetime_with_timezone_support,
datetime.datetime: adapt_datetime_with_timezone_support,
})
@@ -109,7 +109,7 @@ def adapt_datetime_with_timezone_support(value, conv):
# MySQL-4.1 and newer, so the MysqlDebugWrapper is unnecessary. Since the
# point is to raise Warnings as exceptions, this can be done with the Python
# warning module, and this is setup when the connection is created, and the
-# standard util.CursorDebugWrapper can be used. Also, using sql_mode
+# standard backend_utils.CursorDebugWrapper can be used. Also, using sql_mode
# TRADITIONAL will automatically cause most warnings to be treated as errors.
class CursorWrapper(object):
@@ -61,7 +61,7 @@ def sql_destroy_indexes_for_fields(self, model, fields, style):
index_name = "%s_%s" % (model._meta.db_table, self._digest([f.name for f in fields]))
- from ..util import truncate_name
+ from ..utils import truncate_name
return [
style.SQL_KEYWORD("DROP INDEX") + " " +
@@ -53,7 +53,8 @@ def _setup_environment(environ):
from django.conf import settings
from django.db import utils
-from django.db.backends import BaseDatabaseFeatures, BaseDatabaseOperations, BaseDatabaseWrapper, BaseDatabaseValidation, util
+from django.db.backends import (BaseDatabaseFeatures, BaseDatabaseOperations,
+ BaseDatabaseWrapper, BaseDatabaseValidation, utils as backend_utils)
from django.db.backends.oracle.client import DatabaseClient
from django.db.backends.oracle.creation import DatabaseCreation
from django.db.backends.oracle.introspection import DatabaseIntrospection
@@ -239,7 +240,7 @@ def convert_values(self, value, field):
value = float(value)
# Convert floats to decimals
elif value is not None and field and field.get_internal_type() == 'DecimalField':
- value = util.typecast_decimal(field.format_number(value))
+ value = backend_utils.typecast_decimal(field.format_number(value))
# cx_Oracle always returns datetime.datetime objects for
# DATE and TIMESTAMP columns, but Django wants to see a
# python datetime.date, .time, or .datetime. We use the type
@@ -316,7 +317,7 @@ def quote_name(self, name):
# always defaults to uppercase.
# We simplify things by making Oracle identifiers always uppercase.
if not name.startswith('"') and not name.endswith('"'):
- name = '"%s"' % util.truncate_name(name.upper(),
+ name = '"%s"' % backend_utils.truncate_name(name.upper(),
self.max_name_length())
# Oracle puts the query text into a (query % args) construct, so % signs
# in names need to be escaped. The '%%' will be collapsed back to '%' at
@@ -482,11 +483,11 @@ def combine_expression(self, connector, sub_expressions):
def _get_sequence_name(self, table):
name_length = self.max_name_length() - 3
- return '%s_SQ' % util.truncate_name(table, name_length).upper()
+ return '%s_SQ' % backend_utils.truncate_name(table, name_length).upper()
def _get_trigger_name(self, table):
name_length = self.max_name_length() - 3
- return '%s_TR' % util.truncate_name(table, name_length).upper()
+ return '%s_TR' % backend_utils.truncate_name(table, name_length).upper()
def bulk_insert_sql(self, fields, num_values):
items_sql = "SELECT %s FROM DUAL" % ", ".join(["%s"] * len(fields))
@@ -1,5 +1,5 @@
from django.db.backends.creation import BaseDatabaseCreation
-from django.db.backends.util import truncate_name
+from django.db.backends.utils import truncate_name
class DatabaseCreation(BaseDatabaseCreation):
@@ -2,7 +2,7 @@
import operator
from django.db.backends.creation import BaseDatabaseCreation
-from django.db.backends.util import truncate_name
+from django.db.backends.utils import truncate_name
from django.db.models.fields.related import ManyToManyField
from django.db.transaction import atomic
from django.utils.log import getLogger
Oops, something went wrong.

1 comment on commit 18ffdb1

Owner

jezdez commented on 18ffdb1 Sep 17, 2013

@timgraham You're quickly becoming my favorite core dev!

Please sign in to comment.