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
This commit is contained in:
Malcolm Tredinnick 2007-02-11 23:50:35 +00:00
parent 0e924c70b1
commit 6c4757729b
20 changed files with 21 additions and 33 deletions

View File

@ -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):

View File

@ -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

View File

@ -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'):

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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."

View File

@ -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

View File

@ -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):
"""

View File

@ -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

View File

@ -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.

View File

@ -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')

View File

@ -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

View File

@ -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):

View File

@ -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):

View File

@ -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="!*'();:@&=+$,/?%#[]"

View File

@ -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):

View File

@ -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

View File

@ -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':

View File

@ -391,7 +391,6 @@ False
"""
from django.template.defaultfilters import *
from django.utils.translation import gettext as _
import datetime
if __name__ == '__main__':