Skip to content

Commit 498dc38

Browse files
committed
Port to Django 1.2, replacing built-in patched Django with Django 1.2.7 (with patches applied on top) and replacing South with South 0.7.3
- Legacy-Id: 3773
1 parent 2d521ee commit 498dc38

978 files changed

Lines changed: 132822 additions & 40055 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

django/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = (1, 1, 1, 'final', 0)
1+
VERSION = (1, 2, 7, 'final', 0)
22

33
def get_version():
44
version = '%s.%s' % (VERSION[0], VERSION[1])

django/conf/__init__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def configure(self, default_settings=global_settings, **options):
4646
argument must support attribute access (__getattr__)).
4747
"""
4848
if self._wrapped != None:
49-
raise RuntimeError, 'Settings already configured.'
49+
raise RuntimeError('Settings already configured.')
5050
holder = UserSettingsHolder(default_settings)
5151
for name, value in options.items():
5252
setattr(holder, name, value)
@@ -72,7 +72,7 @@ def __init__(self, settings_module):
7272
try:
7373
mod = importlib.import_module(self.SETTINGS_MODULE)
7474
except ImportError, e:
75-
raise ImportError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
75+
raise ImportError("Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e))
7676

7777
# Settings that should be converted into tuples if they're mistakenly entered
7878
# as strings.
@@ -102,15 +102,12 @@ def __init__(self, settings_module):
102102
new_installed_apps.append(app)
103103
self.INSTALLED_APPS = new_installed_apps
104104

105-
if hasattr(time, 'tzset'):
105+
if hasattr(time, 'tzset') and getattr(self, 'TIME_ZONE'):
106106
# Move the time zone info into os.environ. See ticket #2315 for why
107107
# we don't do this unconditionally (breaks Windows).
108108
os.environ['TZ'] = self.TIME_ZONE
109109
time.tzset()
110110

111-
def get_all_members(self):
112-
return dir(self)
113-
114111
class UserSettingsHolder(object):
115112
"""
116113
Holder for user configured settings.
@@ -129,8 +126,11 @@ def __init__(self, default_settings):
129126
def __getattr__(self, name):
130127
return getattr(self.default_settings, name)
131128

132-
def get_all_members(self):
133-
return dir(self) + dir(self.default_settings)
129+
def __dir__(self):
130+
return self.__dict__.keys() + dir(self.default_settings)
131+
132+
# For Python < 2.6:
133+
__members__ = property(lambda self: self.__dir__())
134134

135135
settings = LazySettings()
136136

django/conf/global_settings.py

Lines changed: 143 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,54 +42,65 @@
4242
# should be the utf-8 encoded local name for the language.
4343
LANGUAGES = (
4444
('ar', gettext_noop('Arabic')),
45-
('bn', gettext_noop('Bengali')),
4645
('bg', gettext_noop('Bulgarian')),
46+
('bn', gettext_noop('Bengali')),
47+
('bs', gettext_noop('Bosnian')),
4748
('ca', gettext_noop('Catalan')),
4849
('cs', gettext_noop('Czech')),
4950
('cy', gettext_noop('Welsh')),
5051
('da', gettext_noop('Danish')),
5152
('de', gettext_noop('German')),
5253
('el', gettext_noop('Greek')),
5354
('en', gettext_noop('English')),
55+
('en-gb', gettext_noop('British English')),
5456
('es', gettext_noop('Spanish')),
57+
('es-ar', gettext_noop('Argentinian Spanish')),
5558
('et', gettext_noop('Estonian')),
56-
('es-ar', gettext_noop('Argentinean Spanish')),
5759
('eu', gettext_noop('Basque')),
5860
('fa', gettext_noop('Persian')),
5961
('fi', gettext_noop('Finnish')),
6062
('fr', gettext_noop('French')),
63+
('fy-nl', gettext_noop('Frisian')),
6164
('ga', gettext_noop('Irish')),
6265
('gl', gettext_noop('Galician')),
63-
('hu', gettext_noop('Hungarian')),
6466
('he', gettext_noop('Hebrew')),
6567
('hi', gettext_noop('Hindi')),
6668
('hr', gettext_noop('Croatian')),
69+
('hu', gettext_noop('Hungarian')),
70+
('id', gettext_noop('Indonesian')),
6771
('is', gettext_noop('Icelandic')),
6872
('it', gettext_noop('Italian')),
6973
('ja', gettext_noop('Japanese')),
7074
('ka', gettext_noop('Georgian')),
71-
('ko', gettext_noop('Korean')),
7275
('km', gettext_noop('Khmer')),
7376
('kn', gettext_noop('Kannada')),
74-
('lv', gettext_noop('Latvian')),
77+
('ko', gettext_noop('Korean')),
7578
('lt', gettext_noop('Lithuanian')),
79+
('lv', gettext_noop('Latvian')),
7680
('mk', gettext_noop('Macedonian')),
81+
('ml', gettext_noop('Malayalam')),
82+
('mn', gettext_noop('Mongolian')),
7783
('nl', gettext_noop('Dutch')),
7884
('no', gettext_noop('Norwegian')),
85+
('nb', gettext_noop('Norwegian Bokmal')),
86+
('nn', gettext_noop('Norwegian Nynorsk')),
7987
('pl', gettext_noop('Polish')),
8088
('pt', gettext_noop('Portuguese')),
8189
('pt-br', gettext_noop('Brazilian Portuguese')),
8290
('ro', gettext_noop('Romanian')),
8391
('ru', gettext_noop('Russian')),
8492
('sk', gettext_noop('Slovak')),
8593
('sl', gettext_noop('Slovenian')),
94+
('sq', gettext_noop('Albanian')),
8695
('sr', gettext_noop('Serbian')),
96+
('sr-latn', gettext_noop('Serbian Latin')),
8797
('sv', gettext_noop('Swedish')),
8898
('ta', gettext_noop('Tamil')),
8999
('te', gettext_noop('Telugu')),
90100
('th', gettext_noop('Thai')),
91101
('tr', gettext_noop('Turkish')),
92102
('uk', gettext_noop('Ukrainian')),
103+
('vi', gettext_noop('Vietnamese')),
93104
('zh-cn', gettext_noop('Simplified Chinese')),
94105
('zh-tw', gettext_noop('Traditional Chinese')),
95106
)
@@ -103,6 +114,10 @@
103114
LOCALE_PATHS = ()
104115
LANGUAGE_COOKIE_NAME = 'django_language'
105116

117+
# If you set this to True, Django will format dates, numbers and calendars
118+
# according to user current locale
119+
USE_L10N = False
120+
106121
# Not-necessarily-technical managers of the site. They get broken link
107122
# notifications and other various e-mails.
108123
MANAGERS = ADMINS
@@ -123,6 +138,7 @@
123138
SEND_BROKEN_LINK_EMAILS = False
124139

125140
# Database connection info.
141+
# Legacy format
126142
DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
127143
DATABASE_NAME = '' # Or path to database file if using sqlite3.
128144
DATABASE_USER = '' # Not used with sqlite3.
@@ -131,6 +147,19 @@
131147
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
132148
DATABASE_OPTIONS = {} # Set to empty dictionary for default.
133149

150+
# New format
151+
DATABASES = {
152+
}
153+
154+
# Classes used to implement db routing behaviour
155+
DATABASE_ROUTERS = []
156+
157+
# The email backend to use. For possible shortcuts see django.core.mail.
158+
# The default is to use the SMTP backend.
159+
# Third-party backends can be specified by providing a Python path
160+
# to a module that defines an EmailBackend class.
161+
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
162+
134163
# Host for sending e-mail.
135164
EMAIL_HOST = 'localhost'
136165

@@ -152,20 +181,21 @@
152181
# See the comments in django/core/template/loader.py for interface
153182
# documentation.
154183
TEMPLATE_LOADERS = (
155-
'django.template.loaders.filesystem.load_template_source',
156-
'django.template.loaders.app_directories.load_template_source',
157-
# 'django.template.loaders.eggs.load_template_source',
184+
'django.template.loaders.filesystem.Loader',
185+
'django.template.loaders.app_directories.Loader',
186+
# 'django.template.loaders.eggs.Loader',
158187
)
159188

160189
# List of processors used by RequestContext to populate the context.
161190
# Each one should be a callable that takes the request object as its
162191
# only parameter and returns a dictionary to add to the context.
163192
TEMPLATE_CONTEXT_PROCESSORS = (
164-
'django.core.context_processors.auth',
193+
'django.contrib.auth.context_processors.auth',
165194
'django.core.context_processors.debug',
166195
'django.core.context_processors.i18n',
167196
'django.core.context_processors.media',
168197
# 'django.core.context_processors.request',
198+
'django.contrib.messages.context_processors.messages',
169199
)
170200

171201
# Output to use in template system for invalid (e.g. misspelled) variables.
@@ -228,7 +258,7 @@
228258
# Default file storage mechanism that holds media.
229259
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
230260

231-
# Absolute path to the directory that holds media.
261+
# Absolute filesystem path to the directory that will hold user-uploaded files.
232262
# Example: "/home/media/media.lawrence.com/"
233263
MEDIA_ROOT = ''
234264

@@ -255,28 +285,98 @@
255285
# you'd pass directly to os.chmod; see http://docs.python.org/lib/os-file-dir.html.
256286
FILE_UPLOAD_PERMISSIONS = None
257287

288+
# Python module path where user will place custom format definition.
289+
# The directory where this setting is pointing should contain subdirectories
290+
# named as the locales, containing a formats.py file
291+
# (i.e. "myproject.locale" for myproject/locale/en/formats.py etc. use)
292+
FORMAT_MODULE_PATH = None
293+
258294
# Default formatting for date objects. See all available format strings here:
259-
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
295+
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
260296
DATE_FORMAT = 'N j, Y'
261297

262298
# Default formatting for datetime objects. See all available format strings here:
263-
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
299+
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
264300
DATETIME_FORMAT = 'N j, Y, P'
265301

266302
# Default formatting for time objects. See all available format strings here:
267-
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
303+
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
268304
TIME_FORMAT = 'P'
269305

270306
# Default formatting for date objects when only the year and month are relevant.
271307
# See all available format strings here:
272-
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
308+
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
273309
YEAR_MONTH_FORMAT = 'F Y'
274310

275311
# Default formatting for date objects when only the month and day are relevant.
276312
# See all available format strings here:
277-
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
313+
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
278314
MONTH_DAY_FORMAT = 'F j'
279315

316+
# Default short formatting for date objects. See all available format strings here:
317+
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
318+
SHORT_DATE_FORMAT = 'm/d/Y'
319+
320+
# Default short formatting for datetime objects.
321+
# See all available format strings here:
322+
# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
323+
SHORT_DATETIME_FORMAT = 'm/d/Y P'
324+
325+
# Default formats to be used when parsing dates from input boxes, in order
326+
# See all available format string here:
327+
# http://docs.python.org/library/datetime.html#strftime-behavior
328+
# * Note that these format strings are different from the ones to display dates
329+
DATE_INPUT_FORMATS = (
330+
'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
331+
'%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
332+
'%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
333+
'%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'
334+
'%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006'
335+
)
336+
337+
# Default formats to be used when parsing times from input boxes, in order
338+
# See all available format string here:
339+
# http://docs.python.org/library/datetime.html#strftime-behavior
340+
# * Note that these format strings are different from the ones to display dates
341+
TIME_INPUT_FORMATS = (
342+
'%H:%M:%S', # '14:30:59'
343+
'%H:%M', # '14:30'
344+
)
345+
346+
# Default formats to be used when parsing dates and times from input boxes,
347+
# in order
348+
# See all available format string here:
349+
# http://docs.python.org/library/datetime.html#strftime-behavior
350+
# * Note that these format strings are different from the ones to display dates
351+
DATETIME_INPUT_FORMATS = (
352+
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
353+
'%Y-%m-%d %H:%M', # '2006-10-25 14:30'
354+
'%Y-%m-%d', # '2006-10-25'
355+
'%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59'
356+
'%m/%d/%Y %H:%M', # '10/25/2006 14:30'
357+
'%m/%d/%Y', # '10/25/2006'
358+
'%m/%d/%y %H:%M:%S', # '10/25/06 14:30:59'
359+
'%m/%d/%y %H:%M', # '10/25/06 14:30'
360+
'%m/%d/%y', # '10/25/06'
361+
)
362+
363+
# First day of week, to be used on calendars
364+
# 0 means Sunday, 1 means Monday...
365+
FIRST_DAY_OF_WEEK = 0
366+
367+
# Decimal separator symbol
368+
DECIMAL_SEPARATOR = '.'
369+
370+
# Boolean that sets whether to add thousand separator when formatting numbers
371+
USE_THOUSAND_SEPARATOR = False
372+
373+
# Number of digits that will be together, when spliting them by
374+
# THOUSAND_SEPARATOR. 0 means no grouping, 3 means splitting by thousands...
375+
NUMBER_GROUPING = 0
376+
377+
# Thousand separator symbol
378+
THOUSAND_SEPARATOR = ','
379+
280380
# Do you want to manage transactions manually?
281381
# Hint: you really don't!
282382
TRANSACTIONS_MANAGED = False
@@ -290,6 +390,8 @@
290390
DEFAULT_TABLESPACE = ''
291391
DEFAULT_INDEX_TABLESPACE = ''
292392

393+
USE_X_FORWARDED_HOST = False
394+
293395
##############
294396
# MIDDLEWARE #
295397
##############
@@ -300,7 +402,9 @@
300402
MIDDLEWARE_CLASSES = (
301403
'django.middleware.common.CommonMiddleware',
302404
'django.contrib.sessions.middleware.SessionMiddleware',
405+
'django.middleware.csrf.CsrfViewMiddleware',
303406
'django.contrib.auth.middleware.AuthenticationMiddleware',
407+
'django.contrib.messages.middleware.MessageMiddleware',
304408
# 'django.middleware.http.ConditionalGetMiddleware',
305409
# 'django.middleware.gzip.GZipMiddleware',
306410
)
@@ -374,12 +478,34 @@
374478
# The number of days a password reset link is valid for
375479
PASSWORD_RESET_TIMEOUT_DAYS = 3
376480

481+
########
482+
# CSRF #
483+
########
484+
485+
# Dotted path to callable to be used as view when a request is
486+
# rejected by the CSRF middleware.
487+
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
488+
489+
# Name and domain for CSRF cookie.
490+
CSRF_COOKIE_NAME = 'csrftoken'
491+
CSRF_COOKIE_DOMAIN = None
492+
493+
############
494+
# MESSAGES #
495+
############
496+
497+
# Class to use as messges backend
498+
MESSAGE_STORAGE = 'django.contrib.messages.storage.user_messages.LegacyFallbackStorage'
499+
500+
# Default values of MESSAGE_LEVEL and MESSAGE_TAGS are defined within
501+
# django.contrib.messages to avoid imports in this settings file.
502+
377503
###########
378504
# TESTING #
379505
###########
380506

381-
# The name of the method to use to invoke the test suite
382-
TEST_RUNNER = 'django.test.simple.run_tests'
507+
# The name of the class to use to run the test suite
508+
TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner'
383509

384510
# The name of the database to use for testing purposes.
385511
# If None, a name of 'test_' + DATABASE_NAME will be assumed

django/conf/locale/__init__.py

Whitespace-only changes.
8.18 KB
Binary file not shown.

0 commit comments

Comments
 (0)