Permalink
Browse files

MERGED MAGIC-REMOVAL BRANCH TO TRUNK. This change is highly backwards…

…-incompatible. Please read http://code.djangoproject.com/wiki/RemovingTheMagic for upgrade instructions.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent d5dbeaa commit f69cf70ed813a8cd7e1f963a14ae39103e8d5265 @adrianholovaty adrianholovaty committed May 2, 2006
Showing 366 changed files with 17,799 additions and 11,165 deletions.
View
@@ -71,6 +71,7 @@ answer newbie questions, and generally made Django that much better:
lakin.wecker@gmail.com
Stuart Langridge <http://www.kryogenix.org/>
Eugene Lazutkin <http://lazutkin.com/blog/>
+ Christopher Lenz <http://www.cmlenz.net/>
limodou
Martin Maney <http://www.chipy.org/Martin_Maney>
Manuzhai
@@ -79,6 +80,7 @@ answer newbie questions, and generally made Django that much better:
mattycakes@gmail.com
Jason McBrayer <http://www.carcosa.net/jason/>
michael.mcewan@gmail.com
+ mir@noris.de
mmarshall
Eric Moritz <http://eric.themoritzfamily.com/>
Robin Munn <http://www.geekforgod.com/>
@@ -102,7 +104,9 @@ answer newbie questions, and generally made Django that much better:
Aaron Swartz <http://www.aaronsw.com/>
Tom Tobin
Joe Topjian <http://joe.terrarum.net/geek/code/python/django/>
+ Malcolm Tredinnick
Amit Upadhyay
+ Geert Vanderkelen
Milton Waddams
Rachel Willmer <http://www.willmer.com/kb/>
wojtek
View
@@ -1 +1 @@
-VERSION = (0, 9, 1, 'SVN')
+VERSION = (0, 95, 'post-magic-removal')
@@ -1,17 +1,17 @@
"Daily cleanup file"
-from django.core.db import db
+from django.db import backend, connection, transaction
DOCUMENTATION_DIRECTORY = '/home/html/documentation/'
def clean_up():
# Clean up old database records
- cursor = db.cursor()
+ cursor = connection.cursor()
cursor.execute("DELETE FROM %s WHERE %s < NOW()" % \
- (db.quote_name('core_sessions'), db.quote_name('expire_date')))
+ (backend.quote_name('core_sessions'), backend.quote_name('expire_date')))
cursor.execute("DELETE FROM %s WHERE %s < NOW() - INTERVAL '1 week'" % \
- (db.quote_name('registration_challenges'), db.quote_name('request_date')))
- db.commit()
+ (backend.quote_name('registration_challenges'), backend.quote_name('request_date')))
+ transaction.commit_unless_managed()
if __name__ == "__main__":
clean_up()
@@ -0,0 +1,73 @@
+"""
+Settings and configuration for Django.
+
+Values will be read from the module specified by the DJANGO_SETTINGS_MODULE environment
+variable, and then from django.conf.global_settings; see the global settings file for
+a list of all possible variables.
+"""
+
+import os
+import sys
+from django.conf import global_settings
+
+ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
+
+class Settings:
+
+ def __init__(self, settings_module):
+
+ # update this dict from global settings (but only for ALL_CAPS settings)
+ for setting in dir(global_settings):
+ if setting == setting.upper():
+ setattr(self, setting, getattr(global_settings, setting))
+
+ # store the settings module in case someone later cares
+ self.SETTINGS_MODULE = settings_module
+
+ try:
+ mod = __import__(self.SETTINGS_MODULE, '', '', [''])
+ except ImportError, e:
+ raise EnvironmentError, "Could not import settings '%s' (is it on sys.path?): %s" % (self.SETTINGS_MODULE, e)
+
+ # Settings that should be converted into tuples if they're mistakenly entered
+ # as strings.
+ tuple_settings = ("INSTALLED_APPS", "TEMPLATE_DIRS")
+
+ for setting in dir(mod):
+ if setting == setting.upper():
+ setting_value = getattr(mod, setting)
+ if setting in tuple_settings and type(setting_value) == str:
+ 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('.*'):
+ appdir = os.path.dirname(__import__(app[:-2], '', '', ['']).__file__)
+ for d in os.listdir(appdir):
+ if d.isalpha() 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
+
+ # move the time zone info into os.environ
+ os.environ['TZ'] = self.TIME_ZONE
+
+# try to load DJANGO_SETTINGS_MODULE
+try:
+ settings_module = os.environ[ENVIRONMENT_VARIABLE]
+ if not settings_module: # If it's set but is an empty string.
+ raise KeyError
+except KeyError:
+ raise EnvironmentError, "Environment variable %s is undefined." % ENVIRONMENT_VARIABLE
+
+# instantiate the configuration object
+settings = Settings(settings_module)
+
+# install the translation machinery so that it is available
+from django.utils import translation
+translation.install()
+
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
@@ -1 +0,0 @@
-__all__ = ['{{ app_name }}']
@@ -1,3 +0,0 @@
-from django.core import meta
-
-# Create your models here.
@@ -79,7 +79,7 @@
SEND_BROKEN_LINK_EMAILS = False
# Database connection info.
-DATABASE_ENGINE = 'postgresql' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
+DATABASE_ENGINE = '' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = '' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
@@ -102,19 +102,16 @@
# List of locations of the template source files, in search order.
TEMPLATE_DIRS = ()
-# Extension on all templates.
-TEMPLATE_FILE_EXTENSION = '.html'
-
# List of callables that know how to import templates from various sources.
# See the comments in django/core/template/loader.py for interface
# documentation.
TEMPLATE_LOADERS = (
- 'django.core.template.loaders.filesystem.load_template_source',
- 'django.core.template.loaders.app_directories.load_template_source',
-# 'django.core.template.loaders.eggs.load_template_source',
+ 'django.template.loaders.filesystem.load_template_source',
+ 'django.template.loaders.app_directories.load_template_source',
+# 'django.template.loaders.eggs.load_template_source',
)
-# List of processors used by DjangoContext to populate the context.
+# List of processors used by RequestContext to populate the context.
# Each one should be a callable that takes the request object as its
# only parameter and returns a dictionary to add to the context.
TEMPLATE_CONTEXT_PROCESSORS = (
@@ -205,6 +202,10 @@
# http://psyco.sourceforge.net/
ENABLE_PSYCO = False
+# Do you want to manage transactions manually?
+# Hint: you really don't!
+TRANSACTIONS_MANAGED = False
+
##############
# MIDDLEWARE #
##############
@@ -213,7 +214,8 @@
# this middleware classes will be applied in the order given, and in the
# response phase the middleware will be applied in reverse order.
MIDDLEWARE_CLASSES = (
- "django.middleware.sessions.SessionMiddleware",
+ "django.contrib.sessions.middleware.SessionMiddleware",
+ "django.contrib.auth.middleware.AuthenticationMiddleware",
# "django.middleware.http.ConditionalGetMiddleware",
# "django.middleware.gzip.GZipMiddleware",
"django.middleware.common.CommonMiddleware",
@@ -9,7 +9,7 @@
MANAGERS = ADMINS
-DATABASE_ENGINE = 'postgresql' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
+DATABASE_ENGINE = '' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = '' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
@@ -45,14 +45,15 @@
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
- 'django.core.template.loaders.filesystem.load_template_source',
- 'django.core.template.loaders.app_directories.load_template_source',
-# 'django.core.template.loaders.eggs.load_template_source',
+ 'django.template.loaders.filesystem.load_template_source',
+ 'django.template.loaders.app_directories.load_template_source',
+# 'django.template.loaders.eggs.load_template_source',
)
MIDDLEWARE_CLASSES = (
"django.middleware.common.CommonMiddleware",
- "django.middleware.sessions.SessionMiddleware",
+ "django.contrib.sessions.middleware.SessionMiddleware",
+ "django.contrib.auth.middleware.AuthenticationMiddleware",
"django.middleware.doc.XViewMiddleware",
)
@@ -64,4 +65,8 @@
)
INSTALLED_APPS = (
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.sites',
)
@@ -5,5 +5,5 @@
# (r'^{{ project_name }}/', include('{{ project_name }}.apps.foo.urls.foo')),
# Uncomment this for admin:
-# (r'^admin/', include('django.contrib.admin.urls.admin')),
+# (r'^admin/', include('django.contrib.admin.urls')),
)
@@ -1,77 +0,0 @@
-"""
-Settings and configuration for Django.
-
-Values will be read from the module specified by the DJANGO_SETTINGS_MODULE environment
-variable, and then from django.conf.global_settings; see the global settings file for
-a list of all possible variables.
-"""
-
-import os
-import sys
-from django.conf import global_settings
-
-ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
-
-# get a reference to this module (why isn't there a __module__ magic var?)
-me = sys.modules[__name__]
-
-# update this dict from global settings (but only for ALL_CAPS settings)
-for setting in dir(global_settings):
- if setting == setting.upper():
- setattr(me, setting, getattr(global_settings, setting))
-
-# try to load DJANGO_SETTINGS_MODULE
-try:
- me.SETTINGS_MODULE = os.environ[ENVIRONMENT_VARIABLE]
- if not me.SETTINGS_MODULE: # If it's set but is an empty string.
- raise KeyError
-except KeyError:
- raise EnvironmentError, "Environment variable %s is undefined." % ENVIRONMENT_VARIABLE
-
-try:
- mod = __import__(me.SETTINGS_MODULE, '', '', [''])
-except ImportError, e:
- raise EnvironmentError, "Could not import %s '%s' (is it on sys.path?): %s" % (ENVIRONMENT_VARIABLE, me.SETTINGS_MODULE, e)
-
-# Settings that should be converted into tuples if they're mistakenly entered
-# as strings.
-tuple_settings = ("INSTALLED_APPS", "TEMPLATE_DIRS")
-
-for setting in dir(mod):
- if setting == setting.upper():
- setting_value = getattr(mod, setting)
- if setting in tuple_settings and type(setting_value) == str:
- setting_value = (setting_value,) # In case the user forgot the comma.
- setattr(me, setting, setting_value)
-
-# Expand entries in INSTALLED_APPS like "django.contrib.*" to a list
-# of all those apps.
-new_installed_apps = []
-for app in me.INSTALLED_APPS:
- if app.endswith('.*'):
- appdir = os.path.dirname(__import__(app[:-2], '', '', ['']).__file__)
- for d in os.listdir(appdir):
- if d.isalpha() and os.path.isdir(os.path.join(appdir, d)):
- new_installed_apps.append('%s.%s' % (app[:-2], d))
- else:
- new_installed_apps.append(app)
-me.INSTALLED_APPS = new_installed_apps
-
-# save DJANGO_SETTINGS_MODULE in case anyone in the future cares
-me.SETTINGS_MODULE = os.environ.get(ENVIRONMENT_VARIABLE, '')
-
-# move the time zone info into os.environ
-os.environ['TZ'] = me.TIME_ZONE
-
-# finally, clean up my namespace
-for k in dir(me):
- if not k.startswith('_') and k != 'me' and k != k.upper():
- delattr(me, k)
-del me, k
-
-# as the last step, install the translation machinery and
-# remove the module again to not clutter the namespace.
-from django.utils import translation
-translation.install()
-del translation
-
@@ -1,9 +1,9 @@
from django.conf.urls.defaults import *
urlpatterns = patterns('',
- (r'^login/$', 'django.views.auth.login.login'),
- (r'^logout/$', 'django.views.auth.login.logout'),
- (r'^login_another/$', 'django.views.auth.login.logout_then_login'),
+ (r'^login/$', 'django.contrib.auth.view.login'),
+ (r'^logout/$', 'django.contrib.auth.views.logout'),
+ (r'^login_another/$', 'django.contrib.auth.views.logout_then_login'),
(r'^register/$', 'ellington.registration.views.registration.signup'),
(r'^register/(?P<challenge_string>\w{32})/$', 'ellington.registration.views.registration.register_form'),
@@ -12,8 +12,8 @@
(r'^profile/welcome/$', 'ellington.registration.views.profile.profile_welcome'),
(r'^profile/edit/$', 'ellington.registration.views.profile.edit_profile'),
- (r'^password_reset/$', 'django.views.registration.passwords.password_reset'),
- (r'^password_reset/done/$', 'django.views.registration.passwords.password_reset_done'),
- (r'^password_change/$', 'django.views.registration.passwords.password_change'),
- (r'^password_change/done/$', 'django.views.registration.passwords.password_change_done'),
+ (r'^password_reset/$', 'django.contrib.auth.views.password_reset'),
+ (r'^password_reset/done/$', 'django.contrib.auth.views.password_reset_done'),
+ (r'^password_change/$', 'django.contrib.auth.views.password_change'),
+ (r'^password_change/done/$', 'django.contrib.auth.views.password_change_done'),
)
Oops, something went wrong. Retry.

0 comments on commit f69cf70

Please sign in to comment.