Ticket #12164: 12164.diff
File 12164.diff, 38.0 KB (added by , 15 years ago) |
---|
-
django/test/simple.py
101 101 raise ValueError("Test label '%s' does not refer to a test class" % label) 102 102 return TestClass(parts[2]) 103 103 104 # Python 2.3 compatibility: TestSuites were made iterable in 2.4.105 # We need to iterate over them, so we add the missing method when106 # necessary.107 try:108 getattr(unittest.TestSuite, '__iter__')109 except AttributeError:110 setattr(unittest.TestSuite, '__iter__', lambda s: iter(s._tests))111 112 104 def partition_suite(suite, classes, bins): 113 105 """ 114 106 Partitions a test suite by test type. -
django/db/models/options.py
1 1 import re 2 2 from bisect import bisect 3 try:4 set5 except NameError:6 from sets import Set as set # Python 2.3 fallback7 3 8 4 from django.conf import settings 9 5 from django.db.models.related import RelatedObject -
django/db/models/fields/__init__.py
3 3 import os 4 4 import re 5 5 import time 6 try:7 import decimal8 except ImportError:9 from django.utils import _decimal as decimal # for Python 2.310 6 11 7 from django.db import connection 12 8 from django.db.models import signals -
django/db/models/fields/related.py
11 11 from django.core import exceptions 12 12 from django import forms 13 13 14 try:15 set16 except NameError:17 from sets import Set as set # Python 2.3 fallback18 19 14 RECURSIVE_RELATIONSHIP_CONSTANT = 'self' 20 15 21 16 pending_lookups = {} -
django/db/models/query_utils.py
12 12 from django.utils import tree 13 13 from django.utils.datastructures import SortedDict 14 14 15 try:16 sorted17 except NameError:18 from django.utils.itercompat import sorted # For Python 2.3.19 20 21 15 class CyclicDependency(Exception): 22 16 """ 23 17 An error when dealing with a collection of objects that have a cyclic -
django/db/backends/sqlite3/base.py
1 1 """ 2 2 SQLite3 backend for django. 3 3 4 Python 2. 3 and 2.4 requirepysqlite2 (http://pysqlite.org/).4 Python 2.4 requires pysqlite2 (http://pysqlite.org/). 5 5 6 6 Python 2.5 and later can use a pysqlite2 module or the sqlite3 module in the 7 7 standard library. … … 29 29 module = 'either pysqlite2 or sqlite3 modules (tried in that order)' 30 30 raise ImproperlyConfigured, "Error loading %s: %s" % (module, exc) 31 31 32 try:33 import decimal34 except ImportError:35 from django.utils import _decimal as decimal # for Python 2.336 37 32 DatabaseError = Database.DatabaseError 38 33 IntegrityError = Database.IntegrityError 39 34 -
django/db/backends/util.py
3 3 4 4 from django.utils.hashcompat import md5_constructor 5 5 6 try:7 import decimal8 except ImportError:9 from django.utils import _decimal as decimal # for Python 2.310 11 6 class CursorDebugWrapper(object): 12 7 def __init__(self, cursor, db): 13 8 self.cursor = cursor -
django/db/backends/__init__.py
4 4 except ImportError: 5 5 # Import copy of _thread_local.py from Python 2.4 6 6 from django.utils._threading_local import local 7 try:8 set9 except NameError:10 # Python 2.3 compat11 from sets import Set as set12 7 13 try:14 import decimal15 except ImportError:16 # Python 2.3 fallback17 from django.utils import _decimal as decimal18 19 8 from django.db.backends import util 20 9 from django.utils import datetime_safe 21 10 -
django/db/backends/creation.py
1 1 import sys 2 2 import time 3 try:4 set5 except NameError:6 # Python 2.3 compat7 from sets import Set as set8 3 9 4 from django.conf import settings 10 5 from django.core.management import call_command -
django/db/transaction.py
19 19 try: 20 20 from functools import wraps 21 21 except ImportError: 22 from django.utils.functional import wraps # Python 2. 3, 2.4 fallback.22 from django.utils.functional import wraps # Python 2.4 fallback. 23 23 from django.db import connection 24 24 from django.conf import settings 25 25 -
django/forms/models.py
15 15 from widgets import media_property 16 16 from formsets import BaseFormSet, formset_factory, DELETION_FIELD_NAME 17 17 18 try:19 set20 except NameError:21 from sets import Set as set # Python 2.3 fallback22 23 18 __all__ = ( 24 19 'ModelForm', 'BaseModelForm', 'model_to_dict', 'fields_for_model', 25 20 'save_instance', 'form_for_fields', 'ModelChoiceField', -
django/forms/fields.py
13 13 except ImportError: 14 14 from StringIO import StringIO 15 15 16 # Python 2.3 fallbacks17 try:18 from decimal import Decimal, DecimalException19 except ImportError:20 from django.utils._decimal import Decimal, DecimalException21 try:22 set23 except NameError:24 from sets import Set as set25 26 16 import django.core.exceptions 27 17 from django.utils.translation import ugettext_lazy as _ 28 18 from django.utils.encoding import smart_unicode, smart_str -
django/forms/widgets.py
2 2 HTML Widget classes 3 3 """ 4 4 5 try:6 set7 except NameError:8 from sets import Set as set # Python 2.3 fallback9 10 5 import copy 11 6 from itertools import chain 12 7 from django.conf import settings -
django/core/serializers/json.py
10 10 from django.utils import datetime_safe 11 11 from django.utils import simplejson 12 12 13 try:14 import decimal15 except ImportError:16 from django.utils import _decimal as decimal # Python 2.3 fallback17 18 13 class Serializer(PythonSerializer): 19 14 """ 20 15 Convert a queryset to JSON. -
django/core/serializers/pyyaml.py
7 7 from StringIO import StringIO 8 8 import yaml 9 9 10 try:11 import decimal12 except ImportError:13 from django.utils import _decimal as decimal # Python 2.3 fallback14 15 10 from django.db import models 16 11 from django.core.serializers.python import Serializer as PythonSerializer 17 12 from django.core.serializers.python import Deserializer as PythonDeserializer -
django/core/urlresolvers.py
18 18 from django.utils.regex_helper import normalize 19 19 from django.utils.thread_support import currentThread 20 20 21 try:22 reversed23 except NameError:24 from django.utils.itercompat import reversed # Python 2.3 fallback25 from sets import Set as set26 27 21 _resolver_cache = {} # Maps URLconf modules to RegexURLResolver instances. 28 22 _callable_cache = {} # Maps view and url pattern names to their view functions. 29 23 -
django/core/cache/backends/locmem.py
77 77 78 78 def set(self, key, value, timeout=None): 79 79 self._lock.writer_enters() 80 # Python 2. 3 and 2.4 don't allow combined try-except-finally blocks.80 # Python 2.4 doesn't allow combined try-except-finally blocks. 81 81 try: 82 82 try: 83 83 self._set(key, pickle.dumps(value), timeout) -
django/core/management/commands/makemessages.py
8 8 9 9 from django.core.management.base import CommandError, BaseCommand 10 10 11 try:12 set13 except NameError:14 from sets import Set as set # For Python 2.315 16 11 # Intentionally silence DeprecationWarnings about os.popen3 in Python 2.6. It's 17 12 # still sensible for us to use it, since subprocess didn't exist in 2.3. 18 13 warnings.filterwarnings('ignore', category=DeprecationWarning, message=r'os\.popen3') -
django/core/management/commands/loaddata.py
8 8 from django.core.management.color import no_style 9 9 10 10 try: 11 set12 except NameError:13 from sets import Set as set # Python 2.3 fallback14 15 try:16 11 import bz2 17 12 has_bz2 = True 18 13 except ImportError: -
django/core/management/commands/compilemessages.py
3 3 from optparse import make_option 4 4 from django.core.management.base import BaseCommand, CommandError 5 5 6 try:7 set8 except NameError:9 from sets import Set as set # For Python 2.310 11 6 def compile_messages(locale=None): 12 7 basedirs = [os.path.join('conf', 'locale'), 'locale'] 13 8 if os.environ.get('DJANGO_SETTINGS_MODULE'): -
django/core/management/commands/syncdb.py
4 4 from optparse import make_option 5 5 import sys 6 6 7 try:8 set9 except NameError:10 from sets import Set as set # Python 2.3 fallback11 12 7 class Command(NoArgsCommand): 13 8 option_list = NoArgsCommand.option_list + ( 14 9 make_option('--noinput', action='store_false', dest='interactive', default=True, -
django/core/management/base.py
12 12 from django.core.exceptions import ImproperlyConfigured 13 13 from django.core.management.color import color_style 14 14 15 try:16 set17 except NameError:18 from sets import Set as set # For Python 2.319 20 15 class CommandError(Exception): 21 16 """ 22 17 Exception class indicating a problem while executing a management -
django/core/management/sql.py
2 2 import os 3 3 import re 4 4 5 try:6 set7 except NameError:8 from sets import Set as set # Python 2.3 fallback9 10 5 def sql_create(app, style): 11 6 "Returns a list of the CREATE TABLE SQL statements for the given app." 12 7 from django.db import connection, models -
django/views/decorators/csrf.py
3 3 try: 4 4 from functools import wraps 5 5 except ImportError: 6 from django.utils.functional import wraps # Python 2. 3, 2.4 fallback.6 from django.utils.functional import wraps # Python 2.4 fallback. 7 7 8 8 csrf_protect = decorator_from_middleware(CsrfViewMiddleware) 9 9 csrf_protect.__name__ = "csrf_protect" -
django/views/decorators/http.py
5 5 try: 6 6 from functools import wraps 7 7 except ImportError: 8 from django.utils.functional import wraps # Python 2. 3, 2.4 fallback.8 from django.utils.functional import wraps # Python 2.4 fallback. 9 9 10 10 from calendar import timegm 11 11 from datetime import timedelta -
django/views/decorators/vary.py
1 1 try: 2 2 from functools import wraps 3 3 except ImportError: 4 from django.utils.functional import wraps # Python 2. 3, 2.4 fallback.4 from django.utils.functional import wraps # Python 2.4 fallback. 5 5 6 6 from django.utils.cache import patch_vary_headers 7 7 -
django/views/decorators/cache.py
14 14 try: 15 15 from functools import wraps 16 16 except ImportError: 17 from django.utils.functional import wraps # Python 2. 3, 2.4 fallback.17 from django.utils.functional import wraps # Python 2.4 fallback. 18 18 19 19 from django.utils.decorators import decorator_from_middleware_with_args, auto_adapt_to_methods 20 20 from django.utils.cache import patch_cache_control, add_never_cache_headers -
django/dispatch/dispatcher.py
1 1 import weakref 2 try:3 set4 except NameError:5 from sets import Set as set # Python 2.3 fallback6 2 7 3 from django.dispatch import saferef 8 4 -
django/utils/translation/trans_real.py
56 56 """ 57 57 This class sets up the GNUTranslations context with regard to output 58 58 charset. Django uses a defined DEFAULT_CHARSET as the output charset on 59 Python 2.4. With Python 2.3, use DjangoTranslation23.59 Python 2.4. 60 60 """ 61 61 def __init__(self, *args, **kw): 62 62 from django.conf import settings … … 83 83 def __repr__(self): 84 84 return "<DjangoTranslation lang:%s>" % self.__language 85 85 86 class DjangoTranslation23(DjangoTranslation):87 """88 Compatibility class that is only used with Python 2.3.89 Python 2.3 doesn't support set_output_charset on translation objects and90 needs this wrapper class to make sure input charsets from translation files91 are correctly translated to output charsets.92 93 With a full switch to Python 2.4, this can be removed from the source.94 """95 def gettext(self, msgid):96 res = self.ugettext(msgid)97 return res.encode(self.django_output_charset)98 99 def ngettext(self, msgid1, msgid2, n):100 res = self.ungettext(msgid1, msgid2, n)101 return res.encode(self.django_output_charset)102 103 86 def translation(language): 104 87 """ 105 88 Returns a translation object. … … 119 102 120 103 # set up the right translation class 121 104 klass = DjangoTranslation 122 if sys.version_info < (2, 4):123 klass = DjangoTranslation23124 105 125 106 globalpath = os.path.join(os.path.dirname(sys.modules[settings.__module__].__file__), 'locale') 126 107 -
django/utils/functional.py
60 60 # Summary of changes made to the Python 2.5 code below: 61 61 # * swapped ``partial`` for ``curry`` to maintain backwards-compatibility 62 62 # in Django. 63 # * Wrapped the ``setattr`` call in ``update_wrapper`` with a try-except64 # block to make it compatible with Python 2.3, which doesn't allow65 # assigning to ``__name__``.66 63 67 64 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Python Software Foundation. 68 65 # All Rights Reserved. … … 90 87 function (defaults to functools.WRAPPER_UPDATES) 91 88 """ 92 89 for attr in assigned: 93 try: 94 setattr(wrapper, attr, getattr(wrapped, attr)) 95 except TypeError: # Python 2.3 doesn't allow assigning to __name__. 96 pass 90 setattr(wrapper, attr, getattr(wrapped, attr)) 97 91 for attr in updated: 98 92 getattr(wrapper, attr).update(getattr(wrapped, attr)) 99 93 # Return the wrapper so this can be used as a decorator via curry() -
django/utils/cache.py
19 19 20 20 import re 21 21 import time 22 try:23 set24 except NameError:25 from sets import Set as set # Python 2.3 fallback26 22 27 23 from django.conf import settings 28 24 from django.core.cache import cache -
django/utils/decorators.py
4 4 try: 5 5 from functools import wraps, update_wrapper 6 6 except ImportError: 7 from django.utils.functional import wraps, update_wrapper # Python 2. 3, 2.4 fallback.7 from django.utils.functional import wraps, update_wrapper # Python 2.4 fallback. 8 8 9 9 10 10 # Licence for MethodDecoratorAdaptor and auto_adapt_to_methods -
django/utils/encoding.py
6 6 7 7 from django.utils.functional import Promise 8 8 9 try:10 from decimal import Decimal11 except ImportError:12 from django.utils._decimal import Decimal # Python 2.3 fallback13 14 15 9 class DjangoUnicodeDecodeError(UnicodeDecodeError): 16 10 def __init__(self, obj, *args): 17 11 self.obj = obj -
django/contrib/formtools/utils.py
32 32 data.append(settings.SECRET_KEY) 33 33 34 34 # Use HIGHEST_PROTOCOL because it's the most efficient. It requires 35 # Python 2.3, but Django requires 2. 3anyway, so that's OK.35 # Python 2.3, but Django requires 2.4 anyway, so that's OK. 36 36 pickled = pickle.dumps(data, pickle.HIGHEST_PROTOCOL) 37 37 38 38 return md5_constructor(pickled).hexdigest() -
django/contrib/admin/validation.py
1 try:2 set3 except NameError:4 from sets import Set as set # Python 2.3 fallback5 6 1 from django.core.exceptions import ImproperlyConfigured 7 2 from django.db import models 8 3 from django.forms.models import BaseModelForm, BaseModelFormSet, fields_for_model, _get_foreign_key -
django/contrib/admin/options.py
21 21 from django.utils.translation import ugettext as _ 22 22 from django.utils.translation import ungettext, ugettext_lazy 23 23 from django.utils.encoding import force_unicode 24 try:25 set26 except NameError:27 from sets import Set as set # Python 2.3 fallback28 24 29 25 HORIZONTAL, VERTICAL = 1, 2 30 26 # returns the <ul> class for a given radio_admin field -
django/contrib/admin/actions.py
12 12 from django.utils.safestring import mark_safe 13 13 from django.utils.text import capfirst 14 14 from django.utils.translation import ugettext_lazy, ugettext as _ 15 try:16 set17 except NameError:18 from sets import Set as set # Python 2.3 fallback19 15 20 16 def delete_selected(modeladmin, request, queryset): 21 17 """ -
django/contrib/admin/views/main.py
9 9 from django.utils.http import urlencode 10 10 import operator 11 11 12 try:13 set14 except NameError:15 from sets import Set as set # Python 2.3 fallback16 17 12 # The system will display a "Show all" link on the change list only if the 18 13 # total result count is less than or equal to this setting. 19 14 MAX_SHOW_ALL_ALLOWED = 200 -
django/contrib/admin/views/decorators.py
2 2 try: 3 3 from functools import wraps 4 4 except ImportError: 5 from django.utils.functional import wraps # Python 2. 3, 2.4 fallback.5 from django.utils.functional import wraps # Python 2.4 fallback. 6 6 7 7 from django import http, template 8 8 from django.conf import settings -
django/contrib/admin/sites.py
14 14 from django.utils.translation import ugettext_lazy, ugettext as _ 15 15 from django.views.decorators.cache import never_cache 16 16 from django.conf import settings 17 try:18 set19 except NameError:20 from sets import Set as set # Python 2.3 fallback21 17 22 18 ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. Note that both fields are case-sensitive.") 23 19 LOGIN_FORM_KEY = 'this_is_the_login_form' -
django/contrib/auth/decorators.py
1 1 try: 2 2 from functools import update_wrapper, wraps 3 3 except ImportError: 4 from django.utils.functional import update_wrapper, wraps # Python 2. 3, 2.4 fallback.4 from django.utils.functional import update_wrapper, wraps # Python 2.4 fallback. 5 5 6 6 from django.contrib.auth import REDIRECT_FIELD_NAME 7 7 from django.http import HttpResponseRedirect -
django/contrib/auth/backends.py
1 try:2 set3 except NameError:4 from sets import Set as set # Python 2.3 fallback5 6 1 from django.db import connection 7 2 from django.contrib.auth.models import User 8 3 9 10 4 class ModelBackend(object): 11 5 """ 12 6 Authenticates against django.contrib.auth.models.User. -
django/contrib/auth/models.py
12 12 13 13 UNUSABLE_PASSWORD = '!' # This will never be a valid hash 14 14 15 try:16 set17 except NameError:18 from sets import Set as set # Python 2.3 fallback19 20 15 def get_hexdigest(algorithm, salt, raw_password): 21 16 """ 22 17 Returns a string of the hexdigest of the given plaintext password and salt -
django/contrib/localflavor/br/forms.py
9 9 from django.utils.translation import ugettext_lazy as _ 10 10 import re 11 11 12 try:13 set14 except NameError:15 from sets import Set as set # For Python 2.316 17 12 phone_digits_re = re.compile(r'^(\d{2})[-\.]?(\d{4})[-\.]?(\d{4})$') 18 13 19 14 class BRZipCodeField(RegexField): -
django/template/defaultfilters.py
11 11 try: 12 12 from functools import wraps 13 13 except ImportError: 14 from django.utils.functional import wraps # Python 2. 3, 2.4 fallback.14 from django.utils.functional import wraps # Python 2.4 fallback. 15 15 16 16 from django.template import Variable, Library 17 17 from django.conf import settings -
django/template/defaulttags.py
3 3 import sys 4 4 import re 5 5 from itertools import cycle as itertools_cycle 6 try:7 reversed8 except NameError:9 from django.utils.itercompat import reversed # Python 2.3 fallback10 6 11 7 from django.template import Node, NodeList, Template, Context, Variable 12 8 from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END, COMMENT_TAG_START, COMMENT_TAG_END -
tests/modeltests/basic/models.py
4 4 5 5 This is a basic model with only two non-primary-key fields. 6 6 """ 7 # Python 2.3 doesn't have set as a builtin8 try:9 set10 except NameError:11 from sets import Set as set12 7 13 # Python 2.3 doesn't have sorted()14 try:15 sorted16 except NameError:17 from django.utils.itercompat import sorted18 19 8 from django.db import models 20 9 21 10 class Article(models.Model): -
tests/modeltests/or_lookups/models.py
8 8 clauses using the variable ``django.db.models.Q`` (or any object with an 9 9 ``add_to_query`` method). 10 10 """ 11 # Python 2.3 doesn't have sorted()12 try:13 sorted14 except NameError:15 from django.utils.itercompat import sorted16 11 17 12 from django.db import models 18 13 -
tests/modeltests/aggregation/models.py
1 1 # coding: utf-8 2 2 from django.db import models 3 3 4 try:5 sorted6 except NameError:7 from django.utils.itercompat import sorted # For Python 2.38 9 4 class Author(models.Model): 10 5 name = models.CharField(max_length=100) 11 6 age = models.IntegerField() -
tests/modeltests/serializers/models.py
6 6 ``QuerySet`` objects to and from "flat" data (i.e. strings). 7 7 """ 8 8 9 try:10 from decimal import Decimal11 except ImportError:12 from django.utils._decimal import Decimal # Python 2.3 fallback13 14 9 from django.db import models 15 10 16 11 class Category(models.Model): -
tests/modeltests/model_forms/models.py
13 13 from django.db import models 14 14 from django.core.files.storage import FileSystemStorage 15 15 16 # Python 2.3 doesn't have sorted()17 try:18 sorted19 except NameError:20 from django.utils.itercompat import sorted21 22 16 temp_storage_dir = tempfile.mkdtemp() 23 17 temp_storage = FileSystemStorage(temp_storage_dir) 24 18 -
tests/regressiontests/model_inheritance_regress/models.py
6 6 7 7 from django.db import models 8 8 9 # Python 2.3 doesn't have sorted()10 try:11 sorted12 except NameError:13 from django.utils.itercompat import sorted14 15 9 class Place(models.Model): 16 10 name = models.CharField(max_length=50) 17 11 address = models.CharField(max_length=80) -
tests/regressiontests/defaultfilters/tests.py
571 571 from django.template.defaultfilters import * 572 572 import datetime 573 573 574 # Python 2.3 doesn't have sorted()575 try:576 sorted577 except NameError:578 from django.utils.itercompat import sorted579 580 574 if __name__ == '__main__': 581 575 import doctest 582 576 doctest.testmod() -
tests/regressiontests/aggregation_regress/models.py
4 4 from django.db import connection, models 5 5 from django.conf import settings 6 6 7 try:8 sorted9 except NameError:10 from django.utils.itercompat import sorted # For Python 2.311 12 7 class Author(models.Model): 13 8 name = models.CharField(max_length=100) 14 9 age = models.IntegerField() -
tests/regressiontests/decorators/tests.py
3 3 try: 4 4 from functools import wraps 5 5 except ImportError: 6 from django.utils.functional import wraps # Python 2. 3, 2.4 fallback.6 from django.utils.functional import wraps # Python 2.4 fallback. 7 7 8 8 from django.http import HttpResponse, HttpRequest 9 9 from django.utils.functional import allow_lazy, lazy, memoize -
tests/regressiontests/i18n/misc.py
87 87 'es-ar' 88 88 """ 89 89 90 # Python 2. 3 and 2.4 returnslightly different results for completely bogus90 # Python 2.4 returns slightly different results for completely bogus 91 91 # locales, so we omit this test for that anything below 2.4. It's relatively 92 92 # harmless in any cases (GIGO). This also means this won't be executed on 93 93 # Jython currently, but life's like that sometimes. (On those platforms, -
tests/regressiontests/model_fields/models.py
2 2 import tempfile 3 3 4 4 try: 5 import decimal6 except ImportError:7 from django.utils import _decimal as decimal # Python 2.3 fallback8 9 try:10 5 # Checking for the existence of Image is enough for CPython, but for PyPy, 11 6 # you need to check for the underlying modules. 12 7 from PIL import Image, _imaging -
tests/regressiontests/auth_backends/tests.py
1 try:2 set3 except NameError:4 from sets import Set as set # Python 2.3 fallback5 6 1 __test__ = {'API_TESTS': """ 7 2 >>> from django.contrib.auth.models import User, Group, Permission, AnonymousUser 8 3 >>> from django.contrib.contenttypes.models import ContentType -
tests/regressiontests/admin_scripts/management/commands/base_command.py
1 1 from django.core.management.base import BaseCommand 2 2 from optparse import make_option 3 # Python 2.3 doesn't have sorted()4 try:5 sorted6 except NameError:7 from django.utils.itercompat import sorted8 3 9 4 class Command(BaseCommand): 10 5 option_list = BaseCommand.option_list + ( -
tests/regressiontests/admin_scripts/management/commands/label_command.py
1 1 from django.core.management.base import LabelCommand 2 # Python 2.3 doesn't have sorted()3 try:4 sorted5 except NameError:6 from django.utils.itercompat import sorted7 2 8 3 class Command(LabelCommand): 9 4 help = "Test Label-based commands" -
tests/regressiontests/admin_scripts/management/commands/app_command.py
1 1 from django.core.management.base import AppCommand 2 # Python 2.3 doesn't have sorted()3 try:4 sorted5 except NameError:6 from django.utils.itercompat import sorted7 2 8 3 class Command(AppCommand): 9 4 help = 'Test Application-based commands' -
tests/regressiontests/admin_scripts/management/commands/noargs_command.py
1 1 from django.core.management.base import NoArgsCommand 2 # Python 2.3 doesn't have sorted()3 try:4 sorted5 except NameError:6 from django.utils.itercompat import sorted7 2 8 3 class Command(NoArgsCommand): 9 4 help = "Test No-args commands" -
tests/regressiontests/utils/tests.py
13 13 import itercompat 14 14 from decorators import DecoratorFromMiddlewareTests 15 15 16 # We need this because "datastructures" uses sorted() and the tests are run in17 # the scope of this module.18 try:19 sorted20 except NameError:21 from django.utils.itercompat import sorted # For Python 2.322 23 16 # Extra tests 24 17 __test__ = { 25 18 'timesince': timesince, -
tests/regressiontests/introspection/tests.py
5 5 6 6 from models import Reporter, Article 7 7 8 try:9 set10 except NameError:11 from sets import Set as set # Python 2.3 fallback12 13 8 # 14 9 # The introspection module is optional, so methods tested here might raise 15 10 # NotImplementedError. This is perfectly acceptable behavior for the backend -
tests/regressiontests/queries/models.py
10 10 from django.db import models 11 11 from django.db.models.query import Q, ITER_CHUNK_SIZE 12 12 13 # Python 2.3 doesn't have sorted()14 try:15 sorted16 except NameError:17 from django.utils.itercompat import sorted18 19 13 class DumbCategory(models.Model): 20 14 pass 21 15 … … 1178 1172 1179 1173 """} 1180 1174 1181 # In Python 2. 3 and the Python 2.6 beta releases, exceptions raised in __len__1175 # In Python 2.6 beta releases, exceptions raised in __len__ 1182 1176 # are swallowed (Python issue 1242657), so these cases return an empty list, 1183 1177 # rather than raising an exception. Not a lot we can do about that, 1184 1178 # unfortunately, due to the way Python handles list() calls internally. Thus, 1185 # we skip the tests for Python 2. 3 and 2.6.1186 if (2, 4) <=sys.version_info < (2, 6):1179 # we skip the tests for Python 2.6. 1180 if sys.version_info < (2, 6): 1187 1181 __test__["API_TESTS"] += """ 1188 1182 # If you're not careful, it's possible to introduce infinite loops via default 1189 1183 # ordering on foreign keys in a cycle. We detect that. -
tests/runtests.py
5 5 6 6 import django.contrib as contrib 7 7 8 try:9 set10 except NameError:11 from sets import Set as set # For Python 2.312 13 14 8 CONTRIB_DIR_NAME = 'django.contrib' 15 9 MODEL_TESTS_DIR_NAME = 'modeltests' 16 10 REGRESSION_TESTS_DIR_NAME = 'regressiontests'