Hi,In the bugtracker/vocabulary.py I'm
getting errors like:'PluggableAuthentication' object has no attribute
'getPrincipals'
# From src/bugtracker/vocabulary.py
class UserTerm(Persistent):
implements(ITitledTokenizedTerm)
def __init__(self,
principal): # This is safe here,
since we only read non-critical
data naked =
removeSecurityProxy(principal)
self.principal = {'id':
naked.id,
'login':
naked.getLogin(),
'title':
naked.title,
'description': naked.description}
self.value = naked.id self.token =
naked.id self.title =
naked.title
class
UserVocabulary(object): implements(IVocabulary,
IVocabularyTokenized) def __init__(self,
context): self.auth =
zapi.principals() def __contains__(self,
value): ids = map(lambda p: p.id,
self.auth.getPrincipals(''))
return value in ids def
__iter__(self): terms = map(lambda
p: UserTerm(p),
self.auth.getPrincipals(''))
return iter(terms) def
__len__(self): return
len(self.auth.getPrincipals('')) def
getQuery(self): return
None def getTerm(self,
value): return
UserTerm(self.auth.getPrincipal(value)) def
getTermByToken(self, token):
return self.getTerm(token)I'm not interested in having principals
that are not in an userfolder in the bugtracker, so I converted it
to:class UserTerm(Persistent):
implements(ITitledTokenizedTerm) def __init__(self,
principal): # This is safe here,
since we only read non-critical
data naked =
removeSecurityProxy(principal)
self.principal = {'id':
naked.id,
'login':
naked.id,
'title':
naked.title,
'description': naked.description}
self.value = naked.id self.token =
naked.id self.title =
naked.titleclass UserVocabulary(object):
implements(IVocabulary, IVocabularyTokenized) def
__init__(self, context): self.auth
= zapi.principals() def __contains__(self,
value): # let's get the keys in
the userfolders ids = [principal
for queriable in self.auth.getQueriables() for principal in
queriable[1]] return value in
ids def
__iter__(self): terms = [
UserTerm(self.auth.getPrincipal(principal)) for queriable in
self.auth.getQueriables() for principal in
queriable[1]] return
iter(terms) def
__len__(self): return
len([principal for queriable in self.auth.getQueriables() for principal in
queriable[1]]) def
getQuery(self): return
None def getTerm(self,
value): return
UserTerm(self.auth.getPrincipal(value)) def
getTermByToken(self, token):
return self.getTerm(token)It's a big hack, BUT at least works, and turns
the bugtracker online again! Suggestions for a better
fix?
Regards
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com