| Index: appengine_django/__init__.py |
| =================================================================== |
| --- appengine_django/__init__.py (Revision 18) |
| +++ appengine_django/__init__.py (Arbeitskopie) |
| @@ -249,7 +249,6 @@ |
| mw_mods = list(getattr(settings, "MIDDLEWARE_CLASSES", ())) |
| disallowed_middleware_mods = ( |
| 'django.contrib.sessions.middleware.SessionMiddleware', |
| - 'django.contrib.auth.middleware.AuthenticationMiddleware', |
| 'django.middleware.doc.XViewMiddleware',) |
| for modname in mw_mods[:]: |
| if modname in disallowed_middleware_mods: |
| @@ -262,15 +261,16 @@ |
| # Remove incompatible application modules |
| app_mods = list(getattr(settings, "INSTALLED_APPS", ())) |
| + allowed_apps = ("django.contrib.auth",) |
|
mattbrown.nz
2008/05/18 11:23:43
We're using a blacklist for middleware modules, fo
aalbrecht
2008/05/18 19:17:47
On 2008/05/18 11:23:43, mattbrown.nz wrote:
> We'r
|
| for app in app_mods[:]: |
| - if app.startswith("django."): |
| + if app.startswith("django.") and app not in allowed_apps: |
| # TODO(mglb): Again this is probably overly broad. |
| app_mods.remove(app) |
| logging.warn("Application module '%s' is not compatible. Removed!" % app) |
| setattr(settings, "INSTALLED_APPS", tuple(app_mods)) |
| # Remove incompatible context processors. |
| - bad_processors = ('django.core.context_processors.auth',) |
| + bad_processors = tuple() |
| ctx_procs = list(getattr(settings, "TEMPLATE_CONTEXT_PROCESSORS", ())) |
| for proc in ctx_procs[:]: |
| if proc in bad_processors: |
| @@ -349,6 +349,7 @@ |
| CleanupDjangoSettings() |
| ModifyAvailableCommands() |
| InstallGoogleSMTPConnection() |
| + InstallAuthentication() |
| logging.debug("Successfully loaded the Google App Engine Helper for Django.") |
| @@ -364,3 +365,12 @@ |
| mail.send_mass_mail = gmail.send_mass_mail |
| mail.mail_admins = gmail.mail_admins |
| mail.mail_managers = gmail.mail_managers |
| + |
| +def InstallAuthentication(): |
| + logging.debug("Installing authentication framework") |
| + from django.contrib.auth import models as django_models |
| + from appengine_django.auth.models import DjangoUser |
| + django_models.User = DjangoUser |
| + from django.contrib.auth import middleware as django_middleware |
| + from appengine_django.auth import middleware |
| + django_middleware.AuthenticationMiddleware = middleware.AuthenticationMiddleware |