Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 0fdabe885baabae291da23570966a9e4a4e4df6d 1 parent 579eb97
Adrian Holovaty authored March 28, 2011
6  tests/regressiontests/decorators/tests.py
... ...
@@ -1,8 +1,4 @@
1  
-from sys import version_info
2  
-try:
3  
-    from functools import wraps
4  
-except ImportError:
5  
-    from django.utils.functional import wraps  # Python 2.4 fallback.
  1
+from functools import wraps
6 2
 
7 3
 from django.contrib.auth.decorators import login_required, permission_required, user_passes_test
8 4
 from django.contrib.admin.views.decorators import staff_member_required
9  tests/regressiontests/i18n/commands/extraction.py
@@ -75,11 +75,10 @@ def test_extraction_error(self):
75 75
         os.chdir(self.test_dir)
76 76
         shutil.copyfile('./templates/template_with_error.txt', './templates/template_with_error.html')
77 77
         self.assertRaises(SyntaxError, management.call_command, 'makemessages', locale=LOCALE, verbosity=0)
78  
-        try: # TODO: Simplify this try/try block when we drop support for Python 2.4
79  
-            try:
80  
-                management.call_command('makemessages', locale=LOCALE, verbosity=0)
81  
-            except SyntaxError, e:
82  
-                self.assertEqual(str(e), 'Translation blocks must not include other block tags: blocktrans (file templates/template_with_error.html, line 3)')
  78
+        try:
  79
+            management.call_command('makemessages', locale=LOCALE, verbosity=0)
  80
+        except SyntaxError, e:
  81
+            self.assertEqual(str(e), 'Translation blocks must not include other block tags: blocktrans (file templates/template_with_error.html, line 3)')
83 82
         finally:
84 83
             os.remove('./templates/template_with_error.html')
85 84
             os.remove('./templates/template_with_error.html.py') # Waiting for #8536 to be fixed
40  tests/regressiontests/i18n/tests.py
@@ -590,19 +590,12 @@ def test_parse_literal_http_header(self):
590 590
         r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-ar,de'}
591 591
         self.assertEqual('es-ar', g(r))
592 592
 
593  
-        # Python 2.3 and 2.4 return slightly different results for completely
594  
-        # bogus locales, so we omit this test for that anything below 2.4.
595  
-        # It's relatively harmless in any cases (GIGO). This also means this
596  
-        # won't be executed on Jython currently, but life's like that
597  
-        # sometimes. (On those platforms, passing in a truly bogus locale
598  
-        # will get you the default locale back.)
599  
-        if sys.version_info >= (2, 5):
600  
-            # This test assumes there won't be a Django translation to a US
601  
-            # variation of the Spanish language, a safe assumption. When the
602  
-            # user sets it as the preferred language, the main 'es'
603  
-            # translation should be selected instead.
604  
-            r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-us'}
605  
-            self.assertEqual(g(r), 'es')
  593
+        # This test assumes there won't be a Django translation to a US
  594
+        # variation of the Spanish language, a safe assumption. When the
  595
+        # user sets it as the preferred language, the main 'es'
  596
+        # translation should be selected instead.
  597
+        r.META = {'HTTP_ACCEPT_LANGUAGE': 'es-us'}
  598
+        self.assertEqual(g(r), 'es')
606 599
 
607 600
         # This tests the following scenario: there isn't a main language (zh)
608 601
         # translation of Django but there is a translation to variation (zh_CN)
@@ -631,20 +624,13 @@ def test_parse_language_cookie(self):
631 624
         r.META = {'HTTP_ACCEPT_LANGUAGE': 'de'}
632 625
         self.assertEqual('es', g(r))
633 626
 
634  
-        # Python 2.3 and 2.4 return slightly different results for completely
635  
-        # bogus locales, so we omit this test for that anything below 2.4.
636  
-        # It's relatively harmless in any cases (GIGO). This also means this
637  
-        # won't be executed on Jython currently, but life's like that
638  
-        # sometimes. (On those platforms, passing in a truly bogus locale
639  
-        # will get you the default locale back.)
640  
-        if sys.version_info >= (2, 5):
641  
-            # This test assumes there won't be a Django translation to a US
642  
-            # variation of the Spanish language, a safe assumption. When the
643  
-            # user sets it as the preferred language, the main 'es'
644  
-            # translation should be selected instead.
645  
-            r.COOKIES = {settings.LANGUAGE_COOKIE_NAME: 'es-us'}
646  
-            r.META = {}
647  
-            self.assertEqual(g(r), 'es')
  627
+        # This test assumes there won't be a Django translation to a US
  628
+        # variation of the Spanish language, a safe assumption. When the
  629
+        # user sets it as the preferred language, the main 'es'
  630
+        # translation should be selected instead.
  631
+        r.COOKIES = {settings.LANGUAGE_COOKIE_NAME: 'es-us'}
  632
+        r.META = {}
  633
+        self.assertEqual(g(r), 'es')
648 634
 
649 635
         # This tests the following scenario: there isn't a main language (zh)
650 636
         # translation of Django but there is a translation to variation (zh_CN)

0 notes on commit 0fdabe8

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