[Zope-Checkins] CVS: Zope/lib/python/OFS - ObjectManager.py:1.163.12.4

Zachery Bir zbir at urbanape.com
Wed Mar 17 07:46:11 EST 2004


On Mar 17, 2004, at 5:32 AM, Stefan H. Holek wrote:

> Zachery,
>
> Just at first glance, once you use getId() you can no longer compare 
> to the string 'Anonymous User' because this is, well, the user's 
> *name*. The anon user has an Id of 'None', IIRC.

Yes, and in the process of fixing my faux pas, I've got the code 
modified to this:

             if hasattr(object, '__ac_local_roles__'):
                 if object.__ac_local_roles__ is None:
                     user=getSecurityManager().getUser()
                     if user is not None:
                         id=user.getId()
                         name=user.getUserName()
                         if name != 'Anonymous User':
                             object.manage_setLocalRoles(id, ['Owner'])

Which should still provide for excepting the Anonymous User, but keying 
the ownership to the Id.

I'll write some tests as soon as I get to work, and get them all 
checked in.

Zac




More information about the Zope-Checkins mailing list