Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Updated Django 1.4.1, WebOb 1.2.2, WebTest 1.4.0, django-browserid 0.…
Browse files Browse the repository at this point in the history
…6, django-sha2 1.4.1, django-webtest 1.5.4, requests 0.14.1
  • Loading branch information
Cameron Dawson committed Oct 3, 2012
1 parent 9b0c80f commit 4998c71
Show file tree
Hide file tree
Showing 3,722 changed files with 273,586 additions and 107,464 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
44 changes: 29 additions & 15 deletions lib/python/django/__init__.py
@@ -1,16 +1,30 @@
VERSION = (1, 3, 3, 'final', 0)
VERSION = (1, 4, 1, 'final', 0)

def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:
if VERSION[3] != 'final':
version = '%s %s %s' % (version, VERSION[3], VERSION[4])
from django.utils.version import get_svn_revision
svn_rev = get_svn_revision()
if svn_rev != u'SVN-unknown':
version = "%s %s" % (version, svn_rev)
return version
def get_version(version=None):
"""Derives a PEP386-compliant version number from VERSION."""
if version is None:
version = VERSION
assert len(version) == 5
assert version[3] in ('alpha', 'beta', 'rc', 'final')

# Now build the two parts of the version number:
# main = X.Y[.Z]
# sub = .devN - for pre-alpha releases
# | {a|b|c}N - for alpha, beta and rc releases

parts = 2 if version[2] == 0 else 3
main = '.'.join(str(x) for x in version[:parts])

sub = ''
if version[3] == 'alpha' and version[4] == 0:
# At the toplevel, this would cause an import loop.
from django.utils.version import get_svn_revision
svn_revision = get_svn_revision()[4:]
if svn_revision != 'unknown':
sub = '.dev%s' % svn_revision

elif version[3] != 'final':
mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
sub = mapping[version[3]] + str(version[4])

return main + sub
3 changes: 2 additions & 1 deletion lib/python/django/bin/profiling/gather_profile_stats.py
Expand Up @@ -8,8 +8,9 @@
"""

from hotshot import stats
import os
import pstats
import sys, os
import sys

def gather_stats(p):
profiles = {}
Expand Down
72 changes: 49 additions & 23 deletions lib/python/django/conf/__init__.py
Expand Up @@ -12,7 +12,7 @@
import warnings

from django.conf import global_settings
from django.utils.functional import LazyObject
from django.utils.functional import LazyObject, empty
from django.utils import importlib

ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
Expand Down Expand Up @@ -47,19 +47,19 @@ def configure(self, default_settings=global_settings, **options):
parameter sets where to retrieve any unspecified values from (its
argument must support attribute access (__getattr__)).
"""
if self._wrapped != None:
if self._wrapped is not empty:
raise RuntimeError('Settings already configured.')
holder = UserSettingsHolder(default_settings)
for name, value in options.items():
setattr(holder, name, value)
self._wrapped = holder

@property
def configured(self):
"""
Returns True if the settings have already been configured.
"""
return bool(self._wrapped)
configured = property(configured)
return self._wrapped is not empty


class BaseSettings(object):
Expand All @@ -68,8 +68,11 @@ class BaseSettings(object):
"""
def __setattr__(self, name, value):
if name in ("MEDIA_URL", "STATIC_URL") and value and not value.endswith('/'):
warnings.warn('If set, %s must end with a slash' % name,
PendingDeprecationWarning)
warnings.warn("If set, %s must end with a slash" % name,
DeprecationWarning)
elif name == "ADMIN_MEDIA_PREFIX":
warnings.warn("The ADMIN_MEDIA_PREFIX setting has been removed; "
"use STATIC_URL instead.", DeprecationWarning)
elif name == "ALLOWED_INCLUDE_ROOTS" and isinstance(value, basestring):
raise ValueError("The ALLOWED_INCLUDE_ROOTS setting must be set "
"to a tuple, not a string.")
Expand Down Expand Up @@ -98,26 +101,13 @@ def __init__(self, settings_module):
for setting in dir(mod):
if setting == setting.upper():
setting_value = getattr(mod, setting)
if setting in tuple_settings and type(setting_value) == str:
if setting in tuple_settings and \
isinstance(setting_value, basestring):
setting_value = (setting_value,) # In case the user forgot the comma.
setattr(self, setting, setting_value)

# Expand entries in INSTALLED_APPS like "django.contrib.*" to a list
# of all those apps.
new_installed_apps = []
for app in self.INSTALLED_APPS:
if app.endswith('.*'):
app_mod = importlib.import_module(app[:-2])
appdir = os.path.dirname(app_mod.__file__)
app_subdirs = os.listdir(appdir)
app_subdirs.sort()
name_pattern = re.compile(r'[a-zA-Z]\w*')
for d in app_subdirs:
if name_pattern.match(d) and os.path.isdir(os.path.join(appdir, d)):
new_installed_apps.append('%s.%s' % (app[:-2], d))
else:
new_installed_apps.append(app)
self.INSTALLED_APPS = new_installed_apps
if not self.SECRET_KEY:
warnings.warn("The SECRET_KEY setting must not be empty.", DeprecationWarning)

if hasattr(time, 'tzset') and self.TIME_ZONE:
# When we can, attempt to validate the timezone. If we can't find
Expand All @@ -138,6 +128,9 @@ def __init__(self, settings_module):
logging_config_module = importlib.import_module(logging_config_path)
logging_config_func = getattr(logging_config_module, logging_config_func_name)

# Backwards-compatibility shim for #16288 fix
compat_patch_logging_config(self.LOGGING)

# ... then invoke it with the logging settings
logging_config_func(self.LOGGING)

Expand Down Expand Up @@ -168,3 +161,36 @@ def __dir__(self):

settings = LazySettings()



def compat_patch_logging_config(logging_config):
"""
Backwards-compatibility shim for #16288 fix. Takes initial value of
``LOGGING`` setting and patches it in-place (issuing deprecation warning)
if "mail_admins" logging handler is configured but has no filters.
"""
# Shim only if LOGGING["handlers"]["mail_admins"] exists,
# but has no "filters" key
if "filters" not in logging_config.get(
"handlers", {}).get(
"mail_admins", {"filters": []}):

warnings.warn(
"You have no filters defined on the 'mail_admins' logging "
"handler: adding implicit debug-false-only filter. "
"See http://docs.djangoproject.com/en/dev/releases/1.4/"
"#request-exceptions-are-now-always-logged",
PendingDeprecationWarning)

filter_name = "require_debug_false"

filters = logging_config.setdefault("filters", {})
while filter_name in filters:
filter_name = filter_name + "_"

filters[filter_name] = {
"()": "django.utils.log.RequireDebugFalse",
}

logging_config["handlers"]["mail_admins"]["filters"] = [filter_name]

0 comments on commit 4998c71

Please sign in to comment.