Re: [Zope3-dev] Bug Tracker

2005-07-15 Thread Stephan Richter
On Wednesday 06 July 2005 06:32, Imaap wrote:
> It's a big hack, BUT at least works, and turns the bugtracker online
> again! Suggestions for a better fix?

Your solution depends on the PrincipalFolder implementation as it assumes that 
the queriable is a container or at least an object that can be iterated over.

The best would be the following:

0. Get rid of the login attribute of the User term entry. It is not needed. We 
should always use the id or title of the principal only. The login is 
protected information.

1. Make the user vocabulary a complex managed vocabulary to which you can add 
new users using the queriables.

2. The way you can add new users to the user vocabulary is via the queriable 
UI as it is already implemented in the grant view.

If you have questions, feel free to E-mail me.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Bug Tracker

2005-07-06 Thread Imaappppp



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