<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2668" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2><FONT size=3>Hi,<BR><BR>In the bugtracker/vocabulary.py I'm
getting errors like:<BR><BR>'PluggableAuthentication' object has no attribute
'getPrincipals'<BR></FONT></FONT><FONT size=2><FONT size=3></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2># From src/<FONT face="Times New Roman"
size=3>bugtracker/vocabulary.py</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT>class UserTerm(Persistent):</FONT></DIV>
<DIV><FONT> implements(ITitledTokenizedTerm)</FONT></DIV>
<DIV><FONT> def __init__(self,
principal):<BR> # This is safe here,
since we only read non-critical
data<BR> naked =
removeSecurityProxy(principal)<BR>
self.principal = {'id':
naked.id,<BR>
'login':
naked.getLogin(),<BR>
'title':
naked.title,<BR>
'description': naked.description}<BR>
self.value = naked.id<BR> self.token =
naked.id<BR> self.title =
naked.title</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2><FONT size=3>class
UserVocabulary(object):<BR> implements(IVocabulary,
IVocabularyTokenized)<BR> def __init__(self,
context):<BR> self.auth =
zapi.principals()<BR> def __contains__(self,
value):<BR> ids = map(lambda p: p.id,
self.auth.getPrincipals(''))<BR>
return value in ids<BR> def
__iter__(self):<BR> terms = map(lambda
p: UserTerm(p),
self.auth.getPrincipals(''))<BR>
return iter(terms)<BR> def
__len__(self):<BR> return
len(self.auth.getPrincipals(''))<BR> def
getQuery(self):<BR> return
None<BR> def getTerm(self,
value):<BR> return
UserTerm(self.auth.getPrincipal(value))<BR> def
getTermByToken(self, token):<BR>
return self.getTerm(token)<BR><BR><BR>I'm not interested in having principals
that are not in an userfolder in <BR>the bugtracker, so I converted it
to:<BR><BR>class UserTerm(Persistent):<BR><BR>
implements(ITitledTokenizedTerm)<BR><BR> def __init__(self,
principal):<BR> # This is safe here,
since we only read non-critical
data<BR> naked =
removeSecurityProxy(principal)<BR>
self.principal = {'id':
naked.id,<BR>
'login':
naked.id,<BR>
'title':
naked.title,<BR>
'description': naked.description}<BR>
self.value = naked.id<BR> self.token =
naked.id<BR> self.title =
naked.title<BR><BR><BR>class UserVocabulary(object):<BR>
implements(IVocabulary, IVocabularyTokenized)<BR> def
__init__(self, context):<BR> self.auth
= zapi.principals()<BR> def __contains__(self,
value):<BR> # let's get the keys in
the userfolders<BR> ids = [principal
for queriable in self.auth.getQueriables() for <BR>principal in
queriable[1]]<BR> return value in
ids<BR> def
__iter__(self):<BR> terms = [
UserTerm(self.auth.getPrincipal(principal)) for <BR>queriable in
self.auth.getQueriables() for principal in
queriable[1]]<BR> return
iter(terms)<BR> def
__len__(self):<BR> return
len([principal for queriable in self.auth.getQueriables() <BR>for principal in
queriable[1]])<BR> def
getQuery(self):<BR> return
None<BR> def getTerm(self,
value):<BR> return
UserTerm(self.auth.getPrincipal(value))<BR> def
getTermByToken(self, token):<BR>
return self.getTerm(token)<BR><BR>It's a big hack, BUT at least works, and turns
the bugtracker online <BR>again! Suggestions for a better
fix?</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Regards</FONT></DIV></BODY></HTML>