Skip to content

Commit 16942e1

Browse files
committed
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
1 parent 89df043 commit 16942e1

File tree

2 files changed

+2
-29
lines changed

2 files changed

+2
-29
lines changed

django/core/management/commands/compilemessages.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
from optparse import make_option
44
from django.core.management.base import BaseCommand, CommandError
55

6-
try:
7-
set
8-
except NameError:
9-
from sets import Set as set # For Python 2.3
10-
116
def compile_messages(locale=None):
127
basedirs = [os.path.join('conf', 'locale'), 'locale']
138
if os.environ.get('DJANGO_SETTINGS_MODULE'):

django/utils/translation/trans_real.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class DjangoTranslation(gettext_module.GNUTranslations):
6060
"""
6161
This class sets up the GNUTranslations context with regard to output
6262
charset. Django uses a defined DEFAULT_CHARSET as the output charset on
63-
Python 2.4. With Python 2.3, use DjangoTranslation23.
63+
Python 2.4.
6464
"""
6565
def __init__(self, *args, **kw):
6666
from django.conf import settings
@@ -87,23 +87,6 @@ def language(self):
8787
def __repr__(self):
8888
return "<DjangoTranslation lang:%s>" % self.__language
8989

90-
class DjangoTranslation23(DjangoTranslation):
91-
"""
92-
Compatibility class that is only used with Python 2.3.
93-
Python 2.3 doesn't support set_output_charset on translation objects and
94-
needs this wrapper class to make sure input charsets from translation files
95-
are correctly translated to output charsets.
96-
97-
With a full switch to Python 2.4, this can be removed from the source.
98-
"""
99-
def gettext(self, msgid):
100-
res = self.ugettext(msgid)
101-
return res.encode(self.django_output_charset)
102-
103-
def ngettext(self, msgid1, msgid2, n):
104-
res = self.ungettext(msgid1, msgid2, n)
105-
return res.encode(self.django_output_charset)
106-
10790
def translation(language):
10891
"""
10992
Returns a translation object.
@@ -121,11 +104,6 @@ def translation(language):
121104

122105
from django.conf import settings
123106

124-
# set up the right translation class
125-
klass = DjangoTranslation
126-
if sys.version_info < (2, 4):
127-
klass = DjangoTranslation23
128-
129107
globalpath = os.path.join(os.path.dirname(sys.modules[settings.__module__].__file__), 'locale')
130108

131109
if settings.SETTINGS_MODULE is not None:
@@ -147,7 +125,7 @@ def _fetch(lang, fallback=None):
147125

148126
def _translation(path):
149127
try:
150-
t = gettext_module.translation('django', path, [loc], klass)
128+
t = gettext_module.translation('django', path, [loc], DjangoTranslation)
151129
t.set_language(lang)
152130
return t
153131
except IOError, e:

0 commit comments

Comments
 (0)