Commit 32b8c3e1 authored by Russell Keith-Magee's avatar Russell Keith-Magee
Browse files

Fixed #7718 -- Added a naive implementation of sorted() for Python 2.3...

Fixed #7718 -- Added a naive implementation of sorted() for Python 2.3 compatibility, and modified test cases to import the function when required.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7914 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 502e9a5a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -67,3 +67,8 @@ def is_iterable(x):
    else:
        return True

def sorted(in_value):
    "A naive implementation of sorted"
    out_value = in_value[:]
    out_value.sort()
    return out_value
+7 −1
Original line number Diff line number Diff line
@@ -4,12 +4,18 @@

This is a basic model with only two non-primary-key fields.
"""

# Python 2.3 doesn't have set as a builtin
try:
    set
except NameError:
    from sets import Set as set

# Python 2.3 doesn't have sorted()
try:
    sorted
except NameError:
    from django.utils.itercompat import sorted

from django.db import models

class Article(models.Model):
+5 −0
Original line number Diff line number Diff line
@@ -8,6 +8,11 @@ Alternatively, use positional arguments, and pass one or more expressions of
clauses using the variable ``django.db.models.Q`` (or any object with an
add_to_query method).
"""
# Python 2.3 doesn't have sorted()
try:
    sorted
except NameError:
    from django.utils.itercompat import sorted

from django.db import models

+5 −0
Original line number Diff line number Diff line
from django.core.management.base import AppCommand
# Python 2.3 doesn't have sorted()
try:
    sorted
except NameError:
    from django.utils.itercompat import sorted

class Command(AppCommand):
    help = 'Test Application-based commands'
+5 −0
Original line number Diff line number Diff line
from django.core.management.base import BaseCommand
from optparse import make_option
# Python 2.3 doesn't have sorted()
try:
    sorted
except NameError:
    from django.utils.itercompat import sorted

class Command(BaseCommand):
    option_list = BaseCommand.option_list + (
Loading