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:
parent
0e924c70b1
commit
6c4757729b
|
@ -7,7 +7,6 @@ certain test -- e.g. being a DateField or ForeignKey.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import gettext as _
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
class FilterSpec(object):
|
class FilterSpec(object):
|
||||||
|
|
|
@ -6,7 +6,7 @@ from django.db import models
|
||||||
from django.utils import dateformat
|
from django.utils import dateformat
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.text import capfirst
|
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
|
from django.template import Library
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ from django import oldforms, template
|
||||||
from django.shortcuts import render_to_response, get_object_or_404
|
from django.shortcuts import render_to_response, get_object_or_404
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.translation import gettext as _
|
|
||||||
|
|
||||||
def user_add_stage(request):
|
def user_add_stage(request):
|
||||||
if not request.user.has_perm('auth.change_user'):
|
if not request.user.has_perm('auth.change_user'):
|
||||||
|
|
|
@ -3,7 +3,7 @@ from django.conf import settings
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.auth import authenticate, login
|
from django.contrib.auth import authenticate, login
|
||||||
from django.shortcuts import render_to_response
|
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 base64, datetime, md5
|
||||||
import cPickle as pickle
|
import cPickle as pickle
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ from django.http import Http404, get_host
|
||||||
from django.core import urlresolvers
|
from django.core import urlresolvers
|
||||||
from django.contrib.admin import utils
|
from django.contrib.admin import utils
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.utils.translation import gettext as _
|
|
||||||
import inspect, os, re
|
import inspect, os, re
|
||||||
|
|
||||||
# Exclude methods starting with these strings from documentation
|
# Exclude methods starting with these strings from documentation
|
||||||
|
|
|
@ -12,7 +12,6 @@ from django.db.models.query import handle_legacy_orderlist, QuerySet
|
||||||
from django.http import Http404, HttpResponse, HttpResponseRedirect
|
from django.http import Http404, HttpResponse, HttpResponseRedirect
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.text import capfirst, get_text_list
|
from django.utils.text import capfirst, get_text_list
|
||||||
from django.utils.translation import gettext as _
|
|
||||||
import operator
|
import operator
|
||||||
|
|
||||||
from django.contrib.admin.models import LogEntry, ADDITION, CHANGE, DELETION
|
from django.contrib.admin.models import LogEntry, ADDITION, CHANGE, DELETION
|
||||||
|
|
|
@ -7,7 +7,6 @@ from django.contrib.sites.models import Site
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.contrib.auth import LOGIN_URL, REDIRECT_FIELD_NAME
|
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'):
|
def login(request, template_name='registration/login.html'):
|
||||||
"Displays the login form and handles the login action."
|
"Displays the login form and handles the login action."
|
||||||
|
|
|
@ -11,7 +11,7 @@ from django.contrib.auth.forms import AuthenticationForm
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.utils.text import normalize_newlines
|
from django.utils.text import normalize_newlines
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ngettext, gettext as _
|
from django.utils.translation import ngettext
|
||||||
import base64, datetime
|
import base64, datetime
|
||||||
|
|
||||||
COMMENTS_PER_PAGE = 20
|
COMMENTS_PER_PAGE = 20
|
||||||
|
|
|
@ -2,7 +2,6 @@ from django.http import Http404
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.contrib.comments.models import Comment, KarmaScore
|
from django.contrib.comments.models import Comment, KarmaScore
|
||||||
from django.utils.translation import gettext as _
|
|
||||||
|
|
||||||
def vote(request, comment_id, vote):
|
def vote(request, comment_id, vote):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -18,7 +18,6 @@ See docs/cache.txt for information on the public API.
|
||||||
from cgi import parse_qsl
|
from cgi import parse_qsl
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache.backends.base import InvalidCacheBackendError
|
from django.core.cache.backends.base import InvalidCacheBackendError
|
||||||
from django.utils.translation import gettext as _
|
|
||||||
|
|
||||||
BACKENDS = {
|
BACKENDS = {
|
||||||
# name for use in settings file --> name of module in "backends" directory
|
# name for use in settings file --> name of module in "backends" directory
|
||||||
|
|
|
@ -235,14 +235,14 @@ def isExistingURL(field_data, all_data):
|
||||||
req = urllib2.Request(field_data,None, headers)
|
req = urllib2.Request(field_data,None, headers)
|
||||||
u = urllib2.urlopen(req)
|
u = urllib2.urlopen(req)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise ValidationError, gettext("Invalid URL: %s") % field_data
|
raise ValidationError, _("Invalid URL: %s") % field_data
|
||||||
except urllib2.HTTPError, e:
|
except urllib2.HTTPError, e:
|
||||||
# 401s are valid; they just mean authorization is required.
|
# 401s are valid; they just mean authorization is required.
|
||||||
# 301 and 302 are redirects; they just mean look somewhere else.
|
# 301 and 302 are redirects; they just mean look somewhere else.
|
||||||
if str(e.code) not in ('401','301','302'):
|
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.
|
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):
|
def isValidUSState(field_data, all_data):
|
||||||
"Checks that the given string is a valid two-letter U.S. state abbreviation"
|
"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.
|
# Scrape the Jing error messages to reword them more nicely.
|
||||||
m = re.search(r'Expected "(.*?)" to terminate element starting on line (\d+)', message)
|
m = re.search(r'Expected "(.*?)" to terminate element starting on line (\d+)', message)
|
||||||
if m:
|
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]})
|
{'tag':m.group(1).replace('/', ''), 'line':m.group(2), 'start':lines[int(m.group(2)) - 1][:30]})
|
||||||
continue
|
continue
|
||||||
if message.strip() == 'text not allowed here':
|
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]})
|
{'line':line, 'start':lines[int(line) - 1][:30]})
|
||||||
continue
|
continue
|
||||||
m = re.search(r'\s*attribute "(.*?)" not allowed at this point; ignored', message)
|
m = re.search(r'\s*attribute "(.*?)" not allowed at this point; ignored', message)
|
||||||
if m:
|
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]})
|
{'attr':m.group(1), 'line':line, 'start':lines[int(line) - 1][:30]})
|
||||||
continue
|
continue
|
||||||
m = re.search(r'\s*unknown element "(.*?)"', message)
|
m = re.search(r'\s*unknown element "(.*?)"', message)
|
||||||
if m:
|
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]})
|
{'tag':m.group(1), 'line':line, 'start':lines[int(line) - 1][:30]})
|
||||||
continue
|
continue
|
||||||
if message.strip() == 'required attributes missing':
|
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]})
|
{'line':line, 'start':lines[int(line) - 1][:30]})
|
||||||
continue
|
continue
|
||||||
m = re.search(r'\s*bad value for attribute "(.*?)"', message)
|
m = re.search(r'\s*bad value for attribute "(.*?)"', message)
|
||||||
if m:
|
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]})
|
{'attr':m.group(1), 'line':line, 'start':lines[int(line) - 1][:30]})
|
||||||
continue
|
continue
|
||||||
# Failing all those checks, use the default error message.
|
# Failing all those checks, use the default error message.
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core import signals
|
from django.core import signals
|
||||||
from django.dispatch import dispatcher
|
from django.dispatch import dispatcher
|
||||||
from django.utils.translation import gettext as _
|
|
||||||
|
|
||||||
__all__ = ('backend', 'connection', 'DatabaseError')
|
__all__ = ('backend', 'connection', 'DatabaseError')
|
||||||
|
|
||||||
|
|
|
@ -616,7 +616,7 @@ class FileField(Field):
|
||||||
def isWithinMediaRoot(field_data, all_data):
|
def isWithinMediaRoot(field_data, all_data):
|
||||||
f = os.path.abspath(os.path.join(settings.MEDIA_ROOT, field_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))):
|
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)
|
field_list[1].validator_list.append(isWithinMediaRoot)
|
||||||
return field_list
|
return field_list
|
||||||
|
|
||||||
|
|
|
@ -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.fields import AutoField, Field, IntegerField, get_ul_class
|
||||||
from django.db.models.related import RelatedObject
|
from django.db.models.related import RelatedObject
|
||||||
from django.utils.text import capfirst
|
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.utils.functional import curry
|
||||||
from django.core import validators
|
from django.core import validators
|
||||||
from django import oldforms
|
from django import oldforms
|
||||||
|
@ -50,7 +50,7 @@ def manipulator_valid_rel_key(f, self, field_data, all_data):
|
||||||
try:
|
try:
|
||||||
klass._default_manager.get(**{f.rel.field_name: field_data})
|
klass._default_manager.get(**{f.rel.field_name: field_data})
|
||||||
except klass.DoesNotExist:
|
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
|
#HACK
|
||||||
class RelatedField(object):
|
class RelatedField(object):
|
||||||
|
|
|
@ -7,7 +7,6 @@ from django.db.models import signals
|
||||||
from django.utils.functional import curry
|
from django.utils.functional import curry
|
||||||
from django.utils.datastructures import DotExpandedDict
|
from django.utils.datastructures import DotExpandedDict
|
||||||
from django.utils.text import capfirst
|
from django.utils.text import capfirst
|
||||||
from django.utils.translation import gettext as _
|
|
||||||
import types
|
import types
|
||||||
|
|
||||||
def add_manipulators(sender):
|
def add_manipulators(sender):
|
||||||
|
|
|
@ -3,7 +3,6 @@ from Cookie import SimpleCookie
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
from urllib import urlencode, quote
|
from urllib import urlencode, quote
|
||||||
from django.utils.datastructures import MultiValueDict
|
from django.utils.datastructures import MultiValueDict
|
||||||
from django.utils.translation import gettext as _
|
|
||||||
|
|
||||||
RESERVED_CHARS="!*'();:@&=+$,/?%#[]"
|
RESERVED_CHARS="!*'();:@&=+$,/?%#[]"
|
||||||
|
|
||||||
|
|
|
@ -569,7 +569,7 @@ class NullBooleanField(SelectField):
|
||||||
"This SelectField provides 'Yes', 'No' and 'Unknown', mapping results to True, False or None"
|
"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):
|
def __init__(self, field_name, is_required=False, validator_list=None):
|
||||||
if validator_list is None: validator_list = []
|
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)
|
is_required=is_required, validator_list=validator_list)
|
||||||
|
|
||||||
def render(self, data):
|
def render(self, data):
|
||||||
|
|
|
@ -3,7 +3,6 @@ from django.conf import settings
|
||||||
from django.core import management
|
from django.core import management
|
||||||
from django.test.utils import setup_test_environment, teardown_test_environment
|
from django.test.utils import setup_test_environment, teardown_test_environment
|
||||||
from django.test.utils import create_test_db, destroy_test_db
|
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
|
from django.test.testcases import OutputChecker, DocTestRunner
|
||||||
|
|
||||||
# The module name for tests outside models.py
|
# The module name for tests outside models.py
|
||||||
|
|
|
@ -359,9 +359,9 @@ def get_date_formats():
|
||||||
one, the formats provided in the settings will be used.
|
one, the formats provided in the settings will be used.
|
||||||
"""
|
"""
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
date_format = gettext('DATE_FORMAT')
|
date_format = _('DATE_FORMAT')
|
||||||
datetime_format = gettext('DATETIME_FORMAT')
|
datetime_format = _('DATETIME_FORMAT')
|
||||||
time_format = gettext('TIME_FORMAT')
|
time_format = _('TIME_FORMAT')
|
||||||
if date_format == 'DATE_FORMAT':
|
if date_format == 'DATE_FORMAT':
|
||||||
date_format = settings.DATE_FORMAT
|
date_format = settings.DATE_FORMAT
|
||||||
if datetime_format == 'DATETIME_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.
|
one, the formats provided in the settings will be used.
|
||||||
"""
|
"""
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
year_month_format = gettext('YEAR_MONTH_FORMAT')
|
year_month_format = _('YEAR_MONTH_FORMAT')
|
||||||
month_day_format = gettext('MONTH_DAY_FORMAT')
|
month_day_format = _('MONTH_DAY_FORMAT')
|
||||||
if year_month_format == 'YEAR_MONTH_FORMAT':
|
if year_month_format == 'YEAR_MONTH_FORMAT':
|
||||||
year_month_format = settings.YEAR_MONTH_FORMAT
|
year_month_format = settings.YEAR_MONTH_FORMAT
|
||||||
if month_day_format == 'MONTH_DAY_FORMAT':
|
if month_day_format == 'MONTH_DAY_FORMAT':
|
||||||
|
|
|
@ -391,7 +391,6 @@ False
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.template.defaultfilters import *
|
from django.template.defaultfilters import *
|
||||||
from django.utils.translation import gettext as _
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue