mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	queryset-refactor: Removed a whole bunch of unused code. This includes 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
This commit is contained in:
		| @@ -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): | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user