[Zope-dev] Membership and Local Roles

Michael Bernstein mbernstein@profitscape.com
Mon, 18 Sep 2000 17:06:33 -0500


Michael Bernstein wrote:
> 
> Steve Alexander wrote:
> >
> > Michael Bernstein wrote:
> >
> > > I posted this to the PTK list on Friday, but didn't get any responses
> > > over the weekend, so I'm reposting here.
> > >
> > > I feel that a barrier to Loginmanager and Membership becoming more
> > > generally usable for site builders is it's current lack of support for
> > > local roles. Specifically, members do not show up in the local roles
> > > screen (manage_listLocalRoles) user list.
> > >
> > > Through the magic of grep and find, I think I've identified the relevant
> > > sections of code in Zope that need to be duplicated in Membership (or
> > > maybe in LoginManager).
> >
> > I think you've found out why local roles don't work. Congratulations on
> > a successful code hunting mission :-)
> 
> I *think* I've created a getUserNames python method that returns the
> appropriate results:

I have made some more progress (of a sort).

I added another Python Method to the LoginManager called user_names :


Parameter list:

self

Body:

return self.getUserNames()


As far as i can see, this should be functionally equivalent to the
user_names method in User.py:

    def user_names(self):
        return self.getUserNames()


But it doesn't work. On the bright side, I've managed to break the
manage_listLocalRoles local roles screen. This is the first time that
I've had any interaction with the local roles screen, so I guess now I
now I'm messing with the right stuff.

The error message I get is:

Error Type: AttributeError
Error Value: __hash__

Here is the traceback:

Traceback (innermost last):
  File /usr/local/zope/2-2-0/lib/python/ZPublisher/Publish.py, line 222,
in publish_module
  File /usr/local/zope/2-2-0/lib/python/ZPublisher/Publish.py, line 187,
in publish
  File /usr/local/zope/2-2-0/lib/python/Zope/__init__.py, line 221, in
zpublisher_exception_hook
    (Object: ElementWithAttributes)
  File /usr/local/zope/2-2-0/lib/python/ZPublisher/Publish.py, line 171,
in publish
  File /usr/local/zope/2-2-0/lib/python/ZPublisher/mapply.py, line 160,
in mapply
    (Object: manage_listLocalRoles)
  File /usr/local/zope/2-2-0/lib/python/ZPublisher/Publish.py, line 112,
in call_object
    (Object: manage_listLocalRoles)
  File /usr/local/zope/2-2-0/lib/python/App/special_dtml.py, line 121,
in __call__
    (Object: manage_listLocalRoles)
  File /usr/local/zope/2-2-0/lib/python/DocumentTemplate/DT_String.py,
line 502, in __call__
    (Object: manage_listLocalRoles)
  File /usr/local/zope/2-2-0/lib/python/DocumentTemplate/DT_In.py, line
630, in renderwob
    (Object: get_valid_userids)
  File /usr/local/zope/2-2-0/lib/python/AccessControl/Role.py, line 360,
in get_valid_userids
    (Object: ElementWithAttributes)
AttributeError: (see above)

Any ideas?

Michael Bernstein.