listener/app_engine/appengine_django/__init__.py
def CleanupDjangoSettings(settings):
  """Removes incompatible entries from the django settings module."""

  # Ensure this module is installed as an application.
  apps = getattr(settings, "INSTALLED_APPS", ())
  found = False
  for app in apps:
    if app.endswith("appengine_django"):
      found = True
      break
  if not found:
    logging.warn("appengine_django module is not listed as an application!")
    apps += ("appengine_django",)
    setattr(settings, "INSTALLED_APPS", apps)
    logging.info("Added 'appengine_django' as an application")

  # Ensure the database backend is appropriately configured.
  dbe = getattr(settings, "DATABASE_ENGINE", "")
  if dbe != "appengine":
    settings.DATABASE_ENGINE = "appengine"
    logging.warn("DATABASE_ENGINE is not configured as 'appengine'. "
                 "Value overriden!")
  for var in ["NAME", "USER", "PASSWORD", "HOST", "PORT"]:
    val = getattr(settings, "DATABASE_%s" % var, "")
    if val:
      setattr(settings, "DATABASE_%s" % var, "")
      logging.warn("DATABASE_%s should be blank. Value overriden!")

  # Remove incompatible middleware modules.
  mw_mods = list(getattr(settings, "MIDDLEWARE_CLASSES", ()))
  disallowed_middleware_mods = (
    'django.middleware.doc.XViewMiddleware',)
  for modname in mw_mods[:]:
    if modname in disallowed_middleware_mods:
      # Currently only the CommonMiddleware has been ported.  As other base
      # modules are converted, remove from the disallowed_middleware_mods
      # tuple.
      mw_mods.remove(modname)
      logging.warn("Middleware module '%s' is not compatible. Removed!" %
                   modname)
  setattr(settings, "MIDDLEWARE_CLASSES", tuple(mw_mods))

  # Remove incompatible application modules
  app_mods = list(getattr(settings, "INSTALLED_APPS", ()))
  disallowed_apps = (
    'django.contrib.contenttypes',
    'django.contrib.sites',)
  for app in app_mods[:]:
    if app in disallowed_apps:
      app_mods.remove(app)
      logging.warn("Application module '%s' is not compatible. Removed!" % app)
  setattr(settings, "INSTALLED_APPS", tuple(app_mods))

  # Remove incompatible session backends.
  session_backend = getattr(settings, "SESSION_ENGINE", "")
  if session_backend.endswith("file"):
    logging.warn("File session backend is not compatible. Overriden "
                 "to use db backend!")
    setattr(settings, "SESSION_ENGINE", "django.contrib.sessions.backends.db")
Removes incompatible entries from the django settings module.
Removes incompatible entries from the django settings module.
Removes incompatible entries from the django settings module .
def CleanupDjangoSettings(settings):
  apps = getattr(settings, "INSTALLED_APPS", ())
  found = False
  for app in apps:
    if app.endswith("appengine_django"):
      found = True
      break
  if not found:
    logging.warn("appengine_django module is not listed as an application!")
    apps += ("appengine_django",)
    setattr(settings, "INSTALLED_APPS", apps)
    logging.info("Added 'appengine_django' as an application")
  dbe = getattr(settings, "DATABASE_ENGINE", "")
  if dbe != "appengine":
    settings.DATABASE_ENGINE = "appengine"
    logging.warn("DATABASE_ENGINE is not configured as 'appengine'. "
                 "Value overriden!")
  for var in ["NAME", "USER", "PASSWORD", "HOST", "PORT"]:
    val = getattr(settings, "DATABASE_%s" % var, "")
    if val:
      setattr(settings, "DATABASE_%s" % var, "")
      logging.warn("DATABASE_%s should be blank. Value overriden!")
  mw_mods = list(getattr(settings, "MIDDLEWARE_CLASSES", ()))
  disallowed_middleware_mods = (
    'django.middleware.doc.XViewMiddleware',)
  for modname in mw_mods[:]:
    if modname in disallowed_middleware_mods:
      mw_mods.remove(modname)
      logging.warn("Middleware module '%s' is not compatible. Removed!" %
                   modname)
  setattr(settings, "MIDDLEWARE_CLASSES", tuple(mw_mods))
  app_mods = list(getattr(settings, "INSTALLED_APPS", ()))
  disallowed_apps = (
    'django.contrib.contenttypes',
    'django.contrib.sites',)
  for app in app_mods[:]:
    if app in disallowed_apps:
      app_mods.remove(app)
      logging.warn("Application module '%s' is not compatible. Removed!" % app)
  setattr(settings, "INSTALLED_APPS", tuple(app_mods))
  session_backend = getattr(settings, "SESSION_ENGINE", "")
  if session_backend.endswith("file"):
    logging.warn("File session backend is not compatible. Overriden "
                 "to use db backend!")
    setattr(settings, "SESSION_ENGINE", "django.contrib.sessions.backends.db")
def CleanupDjangoSettings ( settings ) : apps = getattr ( settings , "INSTALLED_APPS" , ( ) ) found = False for app in apps : if app . endswith ( "appengine_django" ) : found = True break if not found : logging . warn ( "appengine_django module is not listed as an application!" ) apps += ( "appengine_django" , ) setattr ( settings , "INSTALLED_APPS" , apps ) logging . info ( "Added 'appengine_django' as an application" ) dbe = getattr ( settings , "DATABASE_ENGINE" , "" ) if dbe != "appengine" : settings . DATABASE_ENGINE = "appengine" logging . warn ( "DATABASE_ENGINE is not configured as 'appengine'. " "Value overriden!" ) for var in [ "NAME" , "USER" , "PASSWORD" , "HOST" , "PORT" ] : val = getattr ( settings , "DATABASE_%s" % var , "" ) if val : setattr ( settings , "DATABASE_%s" % var , "" ) logging . warn ( "DATABASE_%s should be blank. Value overriden!" ) mw_mods = list ( getattr ( settings , "MIDDLEWARE_CLASSES" , ( ) ) ) disallowed_middleware_mods = ( 'django.middleware.doc.XViewMiddleware' , ) for modname in mw_mods [ : ] : if modname in disallowed_middleware_mods : mw_mods . remove ( modname ) logging . warn ( "Middleware module '%s' is not compatible. Removed!" % modname ) setattr ( settings , "MIDDLEWARE_CLASSES" , tuple ( mw_mods ) ) app_mods = list ( getattr ( settings , "INSTALLED_APPS" , ( ) ) ) disallowed_apps = ( 'django.contrib.contenttypes' , 'django.contrib.sites' , ) for app in app_mods [ : ] : if app in disallowed_apps : app_mods . remove ( app ) logging . warn ( "Application module '%s' is not compatible. Removed!" % app ) setattr ( settings , "INSTALLED_APPS" , tuple ( app_mods ) ) session_backend = getattr ( settings , "SESSION_ENGINE" , "" ) if session_backend . endswith ( "file" ) : logging . warn ( "File session backend is not compatible. Overriden " "to use db backend!" ) setattr ( settings , "SESSION_ENGINE" , "django.contrib.sessions.backends.db" )
Removes incompatible entries from the django settings module.
Removes incompatible entries from the django settings module .
"""Removes incompatible entries from the django settings module.""" # Ensure this module is installed as an application. # Ensure the database backend is appropriately configured. # Remove incompatible middleware modules. # Currently only the CommonMiddleware has been ported.  As other base # modules are converted, remove from the disallowed_middleware_mods # tuple. # Remove incompatible application modules # Remove incompatible session backends.
settings