r7252 - branches/1.1/turbogears/identity

0 views
Skip to first unread message

svn-c...@turbogears.org

unread,
Mar 19, 2011, 8:35:45 PM3/19/11
to turbogear...@googlegroups.com
Author: chrisz
Date: Sat Mar 19 19:35:43 2011
New Revision: 7252
URL: http://trac.turbogears.org/changeset/7252

Log:
Improved error message when identity provider cannot be loaded.

Modified:
branches/1.1/turbogears/identity/base.py

Modified: branches/1.1/turbogears/identity/base.py
==============================================================================
--- branches/1.1/turbogears/identity/base.py Sat Mar 19 18:58:20 2011 (r7251)
+++ branches/1.1/turbogears/identity/base.py Sat Mar 19 19:35:43 2011 (r7252)
@@ -52,19 +52,22 @@

log.debug("Loading provider from plugin: %s", provider_plugin)

- provider_class = None
for entrypoint in plugins:
- provider_class = entrypoint.load()
+ try:
+ provider_class = entrypoint.load()
+ except Exception:
+ raise IdentityConfigurationException(
+ "IdentityProvider plugin can't be loaded: %s" % provider_plugin)
break
-
- if not provider_class:
+ else:
provider_class = load_class(provider_plugin)

if not provider_class:
raise IdentityConfigurationException(
- "IdentityProvider plugin missing: %s" % provider_plugin )
- else:
- return provider_class()
+ "IdentityProvider plugin missing: %s" % provider_plugin)
+
+ return provider_class()
+

def was_login_attempted():
try:
@@ -72,9 +75,11 @@
except AttributeError:
return False

+
def set_login_attempted(flag):
cherrypy.request.identity_login_attempted = flag

+
def set_current_identity(identity):
cherrypy.request.identity = identity

@@ -84,6 +89,7 @@
except AttributeError:
cherrypy.request.user_name = None

+
def set_current_provider(provider):
cherrypy.request.identityProvider = provider

@@ -127,6 +133,7 @@
"Use identity.encrypt_pw_with_algorithm instead."
)(encrypt_pw_with_algorithm)

+
def encrypt_password(cleartext):
return current_provider.encrypt_password(cleartext)

Reply all
Reply to author
Forward
0 new messages