Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

queryset-refactor: Removed a whole bunch of unused code. This include…

…s the

final remnants of handle_legacy_orderlist(). Refs #245.


git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6501 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit d219428b7cdea1e7b55e4508f85ba4daa32cb66d 1 parent ccc3a47
@malcolmt malcolmt authored
View
27 django/db/models/query.py
@@ -22,33 +22,6 @@
# 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):
View
1  django/db/models/sql/query.py
@@ -15,7 +15,6 @@
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
View
27 django/db/models/sql/utils.py
@@ -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
-
Please sign in to comment.
Something went wrong with that request. Please try again.