Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
pedersen committed Sep 25, 2012
2 parents bcb5e77 + d7c9840 commit fcb2f3d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTING.txt
@@ -0,0 +1,2 @@
Have a look at http://turbogears.org/en/resources
for how to contribute to the TurboGears project.
21 changes: 17 additions & 4 deletions tg/configuration/app_config.py
Expand Up @@ -719,16 +719,29 @@ def add_auth_middleware(self, app, skip_authentication):
from tgming import setup_ming_auth
app = setup_ming_auth(app, skip_authentication=skip_authentication, **auth_args)
else:
from tg.configuration.auth import setup_auth
if 'authenticators' not in auth_args:
try:
pos = auth_args['authenticators'].index(('default', None))
except KeyError:
pos = None
except ValueError:
pos = -1
if pos is None or pos >= 0:
if self.auth_backend == "sqlalchemy":
from tg.configuration.sqla.auth import create_default_authenticator
auth_args, sqlauth = create_default_authenticator(**auth_args)
auth_args['authenticators'] = [('sqlauth', sqlauth)]
authenticator = ('sqlauth', sqlauth)
elif self.auth_backend == "ming":
from tg.configuration.mongo.auth import create_default_authenticator
auth_args, mingauth = create_default_authenticator(**auth_args)
auth_args['authenticators'] = [('mingauth', mingauth)]
authenticator = ('mingauth', mingauth)
else:
authenticator = None
if authenticator:
if pos is None:
auth_args['authenticators'] = [authenticator]
else:
auth_args['authenticators'][pos] = authenticator
from tg.configuration.auth import setup_auth
app = setup_auth(app, skip_authentication=skip_authentication, **auth_args)

return app
Expand Down

0 comments on commit fcb2f3d

Please sign in to comment.