mirror of https://github.com/django/django.git
Made a bunch of simplifications now that we don't support Python 2.4
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15933 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
579eb97961
commit
0fdabe885b
|
@ -1,8 +1,4 @@
|
||||||
from sys import version_info
|
from functools import wraps
|
||||||
try:
|
|
||||||
from functools import wraps
|
|
||||||
except ImportError:
|
|
||||||
from django.utils.functional import wraps # Python 2.4 fallback.
|
|
||||||
|
|
||||||
from django.contrib.auth.decorators import login_required, permission_required, user_passes_test
|
from django.contrib.auth.decorators import login_required, permission_required, user_passes_test
|
||||||
from django.contrib.admin.views.decorators import staff_member_required
|
from django.contrib.admin.views.decorators import staff_member_required
|
||||||
|
|
|
@ -75,7 +75,6 @@ class BasicExtractorTests(ExtractorTests):
|
||||||
os.chdir(self.test_dir)
|
os.chdir(self.test_dir)
|
||||||
shutil.copyfile('./templates/template_with_error.txt', './templates/template_with_error.html')
|
shutil.copyfile('./templates/template_with_error.txt', './templates/template_with_error.html')
|
||||||
self.assertRaises(SyntaxError, management.call_command, 'makemessages', locale=LOCALE, verbosity=0)
|
self.assertRaises(SyntaxError, management.call_command, 'makemessages', locale=LOCALE, verbosity=0)
|
||||||
try: # TODO: Simplify this try/try block when we drop support for Python 2.4
|
|
||||||
try:
|
try:
|
||||||
management.call_command('makemessages', locale=LOCALE, verbosity=0)
|
management.call_command('makemessages', locale=LOCALE, verbosity=0)
|
||||||
except SyntaxError, e:
|
except SyntaxError, e:
|
||||||
|
|
|
@ -590,13 +590,6 @@ class MiscTests(TestCase):
|
||||||
r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-ar,de'}
|
r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-ar,de'}
|
||||||
self.assertEqual('es-ar', g(r))
|
self.assertEqual('es-ar', g(r))
|
||||||
|
|
||||||
# Python 2.3 and 2.4 return slightly different results for completely
|
|
||||||
# bogus locales, so we omit this test for that anything below 2.4.
|
|
||||||
# It's relatively harmless in any cases (GIGO). This also means this
|
|
||||||
# won't be executed on Jython currently, but life's like that
|
|
||||||
# sometimes. (On those platforms, passing in a truly bogus locale
|
|
||||||
# will get you the default locale back.)
|
|
||||||
if sys.version_info >= (2, 5):
|
|
||||||
# This test assumes there won't be a Django translation to a US
|
# This test assumes there won't be a Django translation to a US
|
||||||
# variation of the Spanish language, a safe assumption. When the
|
# variation of the Spanish language, a safe assumption. When the
|
||||||
# user sets it as the preferred language, the main 'es'
|
# user sets it as the preferred language, the main 'es'
|
||||||
|
@ -631,13 +624,6 @@ class MiscTests(TestCase):
|
||||||
r.META = {'HTTP_ACCEPT_LANGUAGE': 'de'}
|
r.META = {'HTTP_ACCEPT_LANGUAGE': 'de'}
|
||||||
self.assertEqual('es', g(r))
|
self.assertEqual('es', g(r))
|
||||||
|
|
||||||
# Python 2.3 and 2.4 return slightly different results for completely
|
|
||||||
# bogus locales, so we omit this test for that anything below 2.4.
|
|
||||||
# It's relatively harmless in any cases (GIGO). This also means this
|
|
||||||
# won't be executed on Jython currently, but life's like that
|
|
||||||
# sometimes. (On those platforms, passing in a truly bogus locale
|
|
||||||
# will get you the default locale back.)
|
|
||||||
if sys.version_info >= (2, 5):
|
|
||||||
# This test assumes there won't be a Django translation to a US
|
# This test assumes there won't be a Django translation to a US
|
||||||
# variation of the Spanish language, a safe assumption. When the
|
# variation of the Spanish language, a safe assumption. When the
|
||||||
# user sets it as the preferred language, the main 'es'
|
# user sets it as the preferred language, the main 'es'
|
||||||
|
|
Loading…
Reference in New Issue