Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed Python 2.3 compat code in translation framework.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12446 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 16942e178f713537ba3d341192019cfd2874d89e 1 parent 89df043
@jezdez jezdez authored
View
5 django/core/management/commands/compilemessages.py
@@ -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'):
View
26 django/utils/translation/trans_real.py
@@ -60,7 +60,7 @@ class DjangoTranslation(gettext_module.GNUTranslations):
"""
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 language(self):
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 @@ def translation(language):
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 _fetch(lang, fallback=None):
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:
Please sign in to comment.
Something went wrong with that request. Please try again.