diff --git a/django/db/models/query.py b/django/db/models/query.py index 66837921fe..a39220a1b1 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -22,33 +22,6 @@ except NameError: # when deleting objects). CHUNK_SIZE = 100 -#################### -# HELPER FUNCTIONS # -#################### - -# FIXME -def orderlist2sql(order_list, opts, prefix=''): - raise NotImplementedError -##def orderlist2sql(order_list, opts, prefix=''): -## qn = connection.ops.quote_name -## if prefix.endswith('.'): -## prefix = qn(prefix[:-1]) + '.' -## output = [] -## for f in handle_legacy_orderlist(order_list): -## if f.startswith('-'): -## output.append('%s%s DESC' % (prefix, qn(orderfield2column(f[1:], opts)))) -## elif f == '?': -## output.append(connection.ops.random_function_sql()) -## else: -## output.append('%s%s ASC' % (prefix, qn(orderfield2column(f, opts)))) -## return ', '.join(output) - -##def quote_only_if_word(word): -## if re.search('\W', word): # Don't quote if there are spaces or non-word chars. -## return word -## else: -## return connection.ops.quote_name(word) - class _QuerySet(object): "Represents a lazy database lookup for a set of objects" def __init__(self, model=None): diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 194d0817cd..c5c7ee07ee 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -15,7 +15,6 @@ from django.db.models.sql.datastructures import Count, Date from django.db.models.fields import FieldDoesNotExist, Field from django.contrib.contenttypes import generic from datastructures import EmptyResultSet -from utils import handle_legacy_orderlist try: reversed diff --git a/django/db/models/sql/utils.py b/django/db/models/sql/utils.py deleted file mode 100644 index 6c6c32ab05..0000000000 --- a/django/db/models/sql/utils.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -Miscellaneous helper functions. -""" - -import warnings - -from django.utils.encoding import smart_unicode - -# Django currently supports two forms of ordering. -# Form 1 (deprecated) example: -# order_by=(('pub_date', 'DESC'), ('headline', 'ASC'), (None, 'RANDOM')) -# Form 2 (new-style) example: -# order_by=('-pub_date', 'headline', '?') -# Form 1 is deprecated and will no longer be supported for Django's first -# official release. The following code converts from Form 1 to Form 2. - -LEGACY_ORDERING_MAPPING = {'ASC': '_', 'DESC': '-_', 'RANDOM': '?'} - -def handle_legacy_orderlist(order_list): - if not order_list or isinstance(order_list[0], basestring): - return order_list - else: - new_order_list = [LEGACY_ORDERING_MAPPING[j.upper()].replace('_', smart_unicode(i)) for i, j in order_list] - warnings.warn("%r ordering syntax is deprecated. Use %r instead." - % (order_list, new_order_list), DeprecationWarning) - return new_order_list -