| Index: appengine_django/__init__.py |
| =================================================================== |
| --- appengine_django/__init__.py (revision 26) |
| +++ appengine_django/__init__.py (working copy) |
| @@ -274,7 +274,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: |
| @@ -287,24 +286,18 @@ |
| # Remove incompatible application modules |
| app_mods = list(getattr(settings, "INSTALLED_APPS", ())) |
| + disallowed_apps = ( |
| + 'django.contrib.contenttypes', |
| + 'django.contrib.sessions', |
| + 'django.contrib.sites',) |
| for app in app_mods[:]: |
| - if app.startswith("django."): |
| + if app in disallowed_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',) |
| - ctx_procs = list(getattr(settings, "TEMPLATE_CONTEXT_PROCESSORS", ())) |
| - for proc in ctx_procs[:]: |
| - if proc in bad_processors: |
| - ctx_procs.remove(proc) |
| - logging.warn("Template Context Processor '%s' is incompatible. Removed!" |
| - % proc) |
| - setattr(settings, "TEMPLATE_CONTEXT_PROCESSORS", tuple(ctx_procs)) |
| - |
| def ModifyAvailableCommands(): |
| """Removes incompatible commands and installs replacements where possible.""" |
| if have_appserver: |
| @@ -374,6 +367,7 @@ |
| CleanupDjangoSettings() |
| ModifyAvailableCommands() |
| InstallGoogleSMTPConnection() |
| + InstallAuthentication() |
| logging.debug("Successfully loaded the Google App Engine Helper for Django.") |
| @@ -389,3 +383,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 |