diff --git a/concept.py b/concept.py index 2421d8b..a4b25ae 100644 --- a/concept.py +++ b/concept.py @@ -476,7 +476,10 @@ class IndexAttributes(object): for c in cr: try: principal = pau.getPrincipal(c) - creators.append(principal.title) + if principal is None: + creators.append(c) + else: + creators.append(principal.title) except PrincipalLookupError: creators.append(c) return creators diff --git a/organize/member.py b/organize/member.py index b51ccf0..ed0f0d1 100644 --- a/organize/member.py +++ b/organize/member.py @@ -78,14 +78,21 @@ class MemberRegistrationManager(object): useExisting, **kw) def createPrincipal(self, pfName, userId, password, lastName, - firstName=u'', groups=[], useExisting=False, **kw): + firstName=u'', groups=[], useExisting=False, + overwrite=False, **kw): pFolder = getPrincipalFolder(self.context, pfName) if IPersonBasedAuthenticator.providedBy(pFolder): pFolder.setPassword(userId, password) else: title = firstName and ' '.join((firstName, lastName)) or lastName principal = InternalPrincipal(userId, password, title) - if useExisting: + if overwrite: + if userId in pFolder: + principal = pFolder[userId] + principal.password = password + else: + pFolder[userId] = principal + elif useExisting: if userId not in pFolder: pFolder[userId] = principal else: