Author: jezdez
Date: 2010-02-16 06:16:01 -0600 (Tue, 16 Feb 2010)
New Revision: 12446

Modified:
   django/trunk/django/core/management/commands/compilemessages.py
   django/trunk/django/utils/translation/trans_real.py
Log:
Removed Python 2.3 compat code in translation framework.

Modified: django/trunk/django/core/management/commands/compilemessages.py
===================================================================
--- django/trunk/django/core/management/commands/compilemessages.py     
2010-02-16 12:15:41 UTC (rev 12445)
+++ django/trunk/django/core/management/commands/compilemessages.py     
2010-02-16 12:16:01 UTC (rev 12446)
@@ -3,11 +3,6 @@
 from optparse import make_option
 from django.core.management.base import BaseCommand, CommandError
 
-try:
-    set
-except NameError:
-    from sets import Set as set     # For Python 2.3
-
 def compile_messages(locale=None):
     basedirs = [os.path.join('conf', 'locale'), 'locale']
     if os.environ.get('DJANGO_SETTINGS_MODULE'):

Modified: django/trunk/django/utils/translation/trans_real.py
===================================================================
--- django/trunk/django/utils/translation/trans_real.py 2010-02-16 12:15:41 UTC 
(rev 12445)
+++ django/trunk/django/utils/translation/trans_real.py 2010-02-16 12:16:01 UTC 
(rev 12446)
@@ -60,7 +60,7 @@
     """
     This class sets up the GNUTranslations context with regard to output
     charset. Django uses a defined DEFAULT_CHARSET as the output charset on
-    Python 2.4. With Python 2.3, use DjangoTranslation23.
+    Python 2.4.
     """
     def __init__(self, *args, **kw):
         from django.conf import settings
@@ -87,23 +87,6 @@
     def __repr__(self):
         return "<DjangoTranslation lang:%s>" % self.__language
 
-class DjangoTranslation23(DjangoTranslation):
-    """
-    Compatibility class that is only used with Python 2.3.
-    Python 2.3 doesn't support set_output_charset on translation objects and
-    needs this wrapper class to make sure input charsets from translation files
-    are correctly translated to output charsets.
-
-    With a full switch to Python 2.4, this can be removed from the source.
-    """
-    def gettext(self, msgid):
-        res = self.ugettext(msgid)
-        return res.encode(self.django_output_charset)
-
-    def ngettext(self, msgid1, msgid2, n):
-        res = self.ungettext(msgid1, msgid2, n)
-        return res.encode(self.django_output_charset)
-
 def translation(language):
     """
     Returns a translation object.
@@ -121,11 +104,6 @@
 
     from django.conf import settings
 
-    # set up the right translation class
-    klass = DjangoTranslation
-    if sys.version_info < (2, 4):
-        klass = DjangoTranslation23
-
     globalpath = 
os.path.join(os.path.dirname(sys.modules[settings.__module__].__file__), 
'locale')
 
     if settings.SETTINGS_MODULE is not None:
@@ -147,7 +125,7 @@
 
         def _translation(path):
             try:
-                t = gettext_module.translation('django', path, [loc], klass)
+                t = gettext_module.translation('django', path, [loc], 
DjangoTranslation)
                 t.set_language(lang)
                 return t
             except IOError, e:

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to