summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-02-11 23:50:35 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-02-11 23:50:35 +0000
commit6c4757729b6dbf2fb824865ba84f776656c8040c (patch)
tree05691c3f018b5b53a6eb00787f251c6db286c521
parent0e924c70b1ec5cae635a99d9fe7e279698dc5cd0 (diff)
Revert [4485] in order to fix accidental mod_python breakage. Refs #2920.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4486 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/admin/filterspecs.py1
-rw-r--r--django/contrib/admin/templatetags/admin_list.py2
-rw-r--r--django/contrib/admin/views/auth.py1
-rw-r--r--django/contrib/admin/views/decorators.py2
-rw-r--r--django/contrib/admin/views/doc.py1
-rw-r--r--django/contrib/admin/views/main.py1
-rw-r--r--django/contrib/auth/views.py1
-rw-r--r--django/contrib/comments/views/comments.py2
-rw-r--r--django/contrib/comments/views/karma.py1
-rw-r--r--django/core/cache/__init__.py1
-rw-r--r--django/core/validators.py18
-rw-r--r--django/db/__init__.py1
-rw-r--r--django/db/models/fields/__init__.py2
-rw-r--r--django/db/models/fields/related.py4
-rw-r--r--django/db/models/manipulators.py1
-rw-r--r--django/http/__init__.py1
-rw-r--r--django/oldforms/__init__.py2
-rw-r--r--django/test/simple.py1
-rw-r--r--django/utils/translation/trans_real.py10
-rw-r--r--tests/regressiontests/defaultfilters/tests.py1
20 files changed, 21 insertions, 33 deletions
diff --git a/django/contrib/admin/filterspecs.py b/django/contrib/admin/filterspecs.py
index 8d0f60f0ad..8c2b82147e 100644
--- a/django/contrib/admin/filterspecs.py
+++ b/django/contrib/admin/filterspecs.py
@@ -7,7 +7,6 @@ certain test -- e.g. being a DateField or ForeignKey.
"""
from django.db import models
-from django.utils.translation import gettext as _
import datetime
class FilterSpec(object):
diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
index 6041c3208d..3c0c6f0ac2 100644
--- a/django/contrib/admin/templatetags/admin_list.py
+++ b/django/contrib/admin/templatetags/admin_list.py
@@ -6,7 +6,7 @@ from django.db import models
from django.utils import dateformat
from django.utils.html import escape
from django.utils.text import capfirst
-from django.utils.translation import get_date_formats, get_partial_date_formats, gettext as _
+from django.utils.translation import get_date_formats, get_partial_date_formats
from django.template import Library
import datetime
diff --git a/django/contrib/admin/views/auth.py b/django/contrib/admin/views/auth.py
index df5990b74f..bea1f8533c 100644
--- a/django/contrib/admin/views/auth.py
+++ b/django/contrib/admin/views/auth.py
@@ -6,7 +6,6 @@ from django import oldforms, template
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponseRedirect
from django.utils.html import escape
-from django.utils.translation import gettext as _
def user_add_stage(request):
if not request.user.has_perm('auth.change_user'):
diff --git a/django/contrib/admin/views/decorators.py b/django/contrib/admin/views/decorators.py
index d259948ea9..9dfe651fe6 100644
--- a/django/contrib/admin/views/decorators.py
+++ b/django/contrib/admin/views/decorators.py
@@ -3,7 +3,7 @@ from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.shortcuts import render_to_response
-from django.utils.translation import gettext_lazy, gettext as _
+from django.utils.translation import gettext_lazy
import base64, datetime, md5
import cPickle as pickle
diff --git a/django/contrib/admin/views/doc.py b/django/contrib/admin/views/doc.py
index fdc99f2923..4b592acebd 100644
--- a/django/contrib/admin/views/doc.py
+++ b/django/contrib/admin/views/doc.py
@@ -9,7 +9,6 @@ from django.http import Http404, get_host
from django.core import urlresolvers
from django.contrib.admin import utils
from django.contrib.sites.models import Site
-from django.utils.translation import gettext as _
import inspect, os, re
# Exclude methods starting with these strings from documentation
diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py
index 1cca8c657f..282038e205 100644
--- a/django/contrib/admin/views/main.py
+++ b/django/contrib/admin/views/main.py
@@ -12,7 +12,6 @@ from django.db.models.query import handle_legacy_orderlist, QuerySet
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.utils.html import escape
from django.utils.text import capfirst, get_text_list
-from django.utils.translation import gettext as _
import operator
from django.contrib.admin.models import LogEntry, ADDITION, CHANGE, DELETION
diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py
index be3eac2075..fda17b91fb 100644
--- a/django/contrib/auth/views.py
+++ b/django/contrib/auth/views.py
@@ -7,7 +7,6 @@ from django.contrib.sites.models import Site
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.contrib.auth import LOGIN_URL, REDIRECT_FIELD_NAME
-from django.utils.translation import gettext as _
def login(request, template_name='registration/login.html'):
"Displays the login form and handles the login action."
diff --git a/django/contrib/comments/views/comments.py b/django/contrib/comments/views/comments.py
index bc156b31b3..12330afe41 100644
--- a/django/contrib/comments/views/comments.py
+++ b/django/contrib/comments/views/comments.py
@@ -11,7 +11,7 @@ from django.contrib.auth.forms import AuthenticationForm
from django.http import HttpResponseRedirect
from django.utils.text import normalize_newlines
from django.conf import settings
-from django.utils.translation import ngettext, gettext as _
+from django.utils.translation import ngettext
import base64, datetime
COMMENTS_PER_PAGE = 20
diff --git a/django/contrib/comments/views/karma.py b/django/contrib/comments/views/karma.py
index de8c6f44a3..8c18523feb 100644
--- a/django/contrib/comments/views/karma.py
+++ b/django/contrib/comments/views/karma.py
@@ -2,7 +2,6 @@ from django.http import Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.comments.models import Comment, KarmaScore
-from django.utils.translation import gettext as _
def vote(request, comment_id, vote):
"""
diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py
index 4195e97da4..6da8e883b9 100644
--- a/django/core/cache/__init__.py
+++ b/django/core/cache/__init__.py
@@ -18,7 +18,6 @@ See docs/cache.txt for information on the public API.
from cgi import parse_qsl
from django.conf import settings
from django.core.cache.backends.base import InvalidCacheBackendError
-from django.utils.translation import gettext as _
BACKENDS = {
# name for use in settings file --> name of module in "backends" directory
diff --git a/django/core/validators.py b/django/core/validators.py
index c937e7bff3..a2f3dc3bc3 100644
--- a/django/core/validators.py
+++ b/django/core/validators.py
@@ -235,14 +235,14 @@ def isExistingURL(field_data, all_data):
req = urllib2.Request(field_data,None, headers)
u = urllib2.urlopen(req)
except ValueError:
- raise ValidationError, gettext("Invalid URL: %s") % field_data
+ raise ValidationError, _("Invalid URL: %s") % field_data
except urllib2.HTTPError, e:
# 401s are valid; they just mean authorization is required.
# 301 and 302 are redirects; they just mean look somewhere else.
if str(e.code) not in ('401','301','302'):
- raise ValidationError, gettext("The URL %s is a broken link.") % field_data
+ raise ValidationError, _("The URL %s is a broken link.") % field_data
except: # urllib2.URLError, httplib.InvalidURL, etc.
- raise ValidationError, gettext("The URL %s is a broken link.") % field_data
+ raise ValidationError, _("The URL %s is a broken link.") % field_data
def isValidUSState(field_data, all_data):
"Checks that the given string is a valid two-letter U.S. state abbreviation"
@@ -537,30 +537,30 @@ class RelaxNGCompact(object):
# Scrape the Jing error messages to reword them more nicely.
m = re.search(r'Expected "(.*?)" to terminate element starting on line (\d+)', message)
if m:
- display_errors.append(gettext('Please close the unclosed %(tag)s tag from line %(line)s. (Line starts with "%(start)s".)') % \
+ display_errors.append(_('Please close the unclosed %(tag)s tag from line %(line)s. (Line starts with "%(start)s".)') % \
{'tag':m.group(1).replace('/', ''), 'line':m.group(2), 'start':lines[int(m.group(2)) - 1][:30]})
continue
if message.strip() == 'text not allowed here':
- display_errors.append(gettext('Some text starting on line %(line)s is not allowed in that context. (Line starts with "%(start)s".)') % \
+ display_errors.append(_('Some text starting on line %(line)s is not allowed in that context. (Line starts with "%(start)s".)') % \
{'line':line, 'start':lines[int(line) - 1][:30]})
continue
m = re.search(r'\s*attribute "(.*?)" not allowed at this point; ignored', message)
if m:
- display_errors.append(gettext('"%(attr)s" on line %(line)s is an invalid attribute. (Line starts with "%(start)s".)') % \
+ display_errors.append(_('"%(attr)s" on line %(line)s is an invalid attribute. (Line starts with "%(start)s".)') % \
{'attr':m.group(1), 'line':line, 'start':lines[int(line) - 1][:30]})
continue
m = re.search(r'\s*unknown element "(.*?)"', message)
if m:
- display_errors.append(gettext('"<%(tag)s>" on line %(line)s is an invalid tag. (Line starts with "%(start)s".)') % \
+ display_errors.append(_('"<%(tag)s>" on line %(line)s is an invalid tag. (Line starts with "%(start)s".)') % \
{'tag':m.group(1), 'line':line, 'start':lines[int(line) - 1][:30]})
continue
if message.strip() == 'required attributes missing':
- display_errors.append(gettext('A tag on line %(line)s is missing one or more required attributes. (Line starts with "%(start)s".)') % \
+ display_errors.append(_('A tag on line %(line)s is missing one or more required attributes. (Line starts with "%(start)s".)') % \
{'line':line, 'start':lines[int(line) - 1][:30]})
continue
m = re.search(r'\s*bad value for attribute "(.*?)"', message)
if m:
- display_errors.append(gettext('The "%(attr)s" attribute on line %(line)s has an invalid value. (Line starts with "%(start)s".)') % \
+ display_errors.append(_('The "%(attr)s" attribute on line %(line)s has an invalid value. (Line starts with "%(start)s".)') % \
{'attr':m.group(1), 'line':line, 'start':lines[int(line) - 1][:30]})
continue
# Failing all those checks, use the default error message.
diff --git a/django/db/__init__.py b/django/db/__init__.py
index 14d42b39c9..4176b5aa79 100644
--- a/django/db/__init__.py
+++ b/django/db/__init__.py
@@ -1,7 +1,6 @@
from django.conf import settings
from django.core import signals
from django.dispatch import dispatcher
-from django.utils.translation import gettext as _
__all__ = ('backend', 'connection', 'DatabaseError')
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index 8a1e499bd5..024fa95b8e 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -616,7 +616,7 @@ class FileField(Field):
def isWithinMediaRoot(field_data, all_data):
f = os.path.abspath(os.path.join(settings.MEDIA_ROOT, field_data))
if not f.startswith(os.path.abspath(os.path.normpath(settings.MEDIA_ROOT))):
- raise validators.ValidationError, gettext("Enter a valid filename.")
+ raise validators.ValidationError, _("Enter a valid filename.")
field_list[1].validator_list.append(isWithinMediaRoot)
return field_list
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index 35983203de..b517747735 100644
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
@@ -3,7 +3,7 @@ from django.db.models import signals, get_model
from django.db.models.fields import AutoField, Field, IntegerField, get_ul_class
from django.db.models.related import RelatedObject
from django.utils.text import capfirst
-from django.utils.translation import gettext_lazy, string_concat, ngettext, gettext
+from django.utils.translation import gettext_lazy, string_concat, ngettext
from django.utils.functional import curry
from django.core import validators
from django import oldforms
@@ -50,7 +50,7 @@ def manipulator_valid_rel_key(f, self, field_data, all_data):
try:
klass._default_manager.get(**{f.rel.field_name: field_data})
except klass.DoesNotExist:
- raise validators.ValidationError, gettext("Please enter a valid %s.") % f.verbose_name
+ raise validators.ValidationError, _("Please enter a valid %s.") % f.verbose_name
#HACK
class RelatedField(object):
diff --git a/django/db/models/manipulators.py b/django/db/models/manipulators.py
index ad73091461..aea3aa70a7 100644
--- a/django/db/models/manipulators.py
+++ b/django/db/models/manipulators.py
@@ -7,7 +7,6 @@ from django.db.models import signals
from django.utils.functional import curry
from django.utils.datastructures import DotExpandedDict
from django.utils.text import capfirst
-from django.utils.translation import gettext as _
import types
def add_manipulators(sender):
diff --git a/django/http/__init__.py b/django/http/__init__.py
index 3a4acd1a36..a6538b7d4a 100644
--- a/django/http/__init__.py
+++ b/django/http/__init__.py
@@ -3,7 +3,6 @@ from Cookie import SimpleCookie
from pprint import pformat
from urllib import urlencode, quote
from django.utils.datastructures import MultiValueDict
-from django.utils.translation import gettext as _
RESERVED_CHARS="!*'();:@&=+$,/?%#[]"
diff --git a/django/oldforms/__init__.py b/django/oldforms/__init__.py
index e78baf7113..decf0f7064 100644
--- a/django/oldforms/__init__.py
+++ b/django/oldforms/__init__.py
@@ -569,7 +569,7 @@ class NullBooleanField(SelectField):
"This SelectField provides 'Yes', 'No' and 'Unknown', mapping results to True, False or None"
def __init__(self, field_name, is_required=False, validator_list=None):
if validator_list is None: validator_list = []
- SelectField.__init__(self, field_name, choices=[('1', gettext('Unknown')), ('2', gettext('Yes')), ('3', gettext('No'))],
+ SelectField.__init__(self, field_name, choices=[('1', _('Unknown')), ('2', _('Yes')), ('3', _('No'))],
is_required=is_required, validator_list=validator_list)
def render(self, data):
diff --git a/django/test/simple.py b/django/test/simple.py
index 9d0bac4641..88e6b49925 100644
--- a/django/test/simple.py
+++ b/django/test/simple.py
@@ -3,7 +3,6 @@ from django.conf import settings
from django.core import management
from django.test.utils import setup_test_environment, teardown_test_environment
from django.test.utils import create_test_db, destroy_test_db
-from django.utils.translation import gettext as _
from django.test.testcases import OutputChecker, DocTestRunner
# The module name for tests outside models.py
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
index 899d58a8ce..94df23a8e9 100644
--- a/django/utils/translation/trans_real.py
+++ b/django/utils/translation/trans_real.py
@@ -359,9 +359,9 @@ def get_date_formats():
one, the formats provided in the settings will be used.
"""
from django.conf import settings
- date_format = gettext('DATE_FORMAT')
- datetime_format = gettext('DATETIME_FORMAT')
- time_format = gettext('TIME_FORMAT')
+ date_format = _('DATE_FORMAT')
+ datetime_format = _('DATETIME_FORMAT')
+ time_format = _('TIME_FORMAT')
if date_format == 'DATE_FORMAT':
date_format = settings.DATE_FORMAT
if datetime_format == 'DATETIME_FORMAT':
@@ -377,8 +377,8 @@ def get_partial_date_formats():
one, the formats provided in the settings will be used.
"""
from django.conf import settings
- year_month_format = gettext('YEAR_MONTH_FORMAT')
- month_day_format = gettext('MONTH_DAY_FORMAT')
+ year_month_format = _('YEAR_MONTH_FORMAT')
+ month_day_format = _('MONTH_DAY_FORMAT')
if year_month_format == 'YEAR_MONTH_FORMAT':
year_month_format = settings.YEAR_MONTH_FORMAT
if month_day_format == 'MONTH_DAY_FORMAT':
diff --git a/tests/regressiontests/defaultfilters/tests.py b/tests/regressiontests/defaultfilters/tests.py
index ec5d26aba1..481557b782 100644
--- a/tests/regressiontests/defaultfilters/tests.py
+++ b/tests/regressiontests/defaultfilters/tests.py
@@ -391,7 +391,6 @@ False
"""
from django.template.defaultfilters import *
-from django.utils.translation import gettext as _
import datetime
if __name__ == '__main__':