Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Malcolm Tredinnick authored October 14, 2007
27  django/db/models/query.py
@@ -22,33 +22,6 @@
22 22
 # when deleting objects).
23 23
 CHUNK_SIZE = 100
24 24
 
25  
-####################
26  
-# HELPER FUNCTIONS #
27  
-####################
28  
-
29  
-# FIXME
30  
-def orderlist2sql(order_list, opts, prefix=''):
31  
-    raise NotImplementedError
32  
-##def orderlist2sql(order_list, opts, prefix=''):
33  
-##    qn = connection.ops.quote_name
34  
-##    if prefix.endswith('.'):
35  
-##        prefix = qn(prefix[:-1]) + '.'
36  
-##    output = []
37  
-##    for f in handle_legacy_orderlist(order_list):
38  
-##        if f.startswith('-'):
39  
-##            output.append('%s%s DESC' % (prefix, qn(orderfield2column(f[1:], opts))))
40  
-##        elif f == '?':
41  
-##            output.append(connection.ops.random_function_sql())
42  
-##        else:
43  
-##            output.append('%s%s ASC' % (prefix, qn(orderfield2column(f, opts))))
44  
-##    return ', '.join(output)
45  
-
46  
-##def quote_only_if_word(word):
47  
-##    if re.search('\W', word): # Don't quote if there are spaces or non-word chars.
48  
-##        return word
49  
-##    else:
50  
-##        return connection.ops.quote_name(word)
51  
-
52 25
 class _QuerySet(object):
53 26
     "Represents a lazy database lookup for a set of objects"
54 27
     def __init__(self, model=None):
1  django/db/models/sql/query.py
@@ -15,7 +15,6 @@
15 15
 from django.db.models.fields import FieldDoesNotExist, Field
16 16
 from django.contrib.contenttypes import generic
17 17
 from datastructures import EmptyResultSet
18  
-from utils import handle_legacy_orderlist
19 18
 
20 19
 try:
21 20
     reversed
27  django/db/models/sql/utils.py
... ...
@@ -1,27 +0,0 @@
1  
-"""
2  
-Miscellaneous helper functions.
3  
-"""
4  
-
5  
-import warnings
6  
-
7  
-from django.utils.encoding import smart_unicode
8  
-
9  
-# Django currently supports two forms of ordering.
10  
-# Form 1 (deprecated) example:
11  
-#     order_by=(('pub_date', 'DESC'), ('headline', 'ASC'), (None, 'RANDOM'))
12  
-# Form 2 (new-style) example:
13  
-#     order_by=('-pub_date', 'headline', '?')
14  
-# Form 1 is deprecated and will no longer be supported for Django's first
15  
-# official release. The following code converts from Form 1 to Form 2.
16  
-
17  
-LEGACY_ORDERING_MAPPING = {'ASC': '_', 'DESC': '-_', 'RANDOM': '?'}
18  
-
19  
-def handle_legacy_orderlist(order_list):
20  
-    if not order_list or isinstance(order_list[0], basestring):
21  
-        return order_list
22  
-    else:
23  
-        new_order_list = [LEGACY_ORDERING_MAPPING[j.upper()].replace('_', smart_unicode(i)) for i, j in order_list]
24  
-        warnings.warn("%r ordering syntax is deprecated. Use %r instead."
25  
-                % (order_list, new_order_list), DeprecationWarning)
26  
-        return new_order_list
27  
-

0 notes on commit d219428

Please sign in to comment.
Something went wrong with that request. Please try again.