[Zope3-checkins] SVN: ldapauth/trunk/source.py Small corrections to
get to return the default
Nicolas Evrard
nicoe at altern.org
Fri Aug 6 13:02:43 EDT 2004
Log message for revision 26938:
Small corrections to get to return the default
Changed:
U ldapauth/trunk/source.py
-=-
Modified: ldapauth/trunk/source.py
===================================================================
--- ldapauth/trunk/source.py 2004-08-06 16:33:35 UTC (rev 26937)
+++ ldapauth/trunk/source.py 2004-08-06 17:02:43 UTC (rev 26938)
@@ -33,6 +33,7 @@
class LDAPPrincipalSource(Contained, Persistent):
"""A Principal source using LDAP"""
+
implements(ILoginPasswordPrincipalSource, ILDAPBasedPrincipalSource,
IContainerPrincipalSource)
@@ -95,7 +96,11 @@
return principal
def get(self, key, default=None):
- return self[key]
+ principal = self[key]
+ if principal:
+ return principal
+ else:
+ return default
def values(self):
principals = []
@@ -130,6 +135,8 @@
login = uid_dict[self.login_attribute][0],
password = uid_dict['userPassword'][0])
return principal
+ else:
+ return None
def getPrincipal(self, id):
uid = id.split('\t')[2]
@@ -160,7 +167,7 @@
password = node_dict['userPassword'][0])
try:
self[principal.login] = principal
- except DuplicationError, msg:
+ except DuplicationError:
# There is already a principal with this login in the cache
principal = self[principal.login]
principals.append(principal)
More information about the Zope3-Checkins
mailing list