In Zope 2.2.0, I can't rename ZClass instances.

When you rename something, lib/python/OFS/'s
_verifyObjectPaste() method gets called with the object you're renaming
as an argument. The method checks that the current user is authorized to
create objects of that kind, and that the current user is authorized to
create that object in the current context.

The problem seems to be that, in the case of renmaing a ZClass instance,
when the ZopeSecurityPolicy tries to get a __roles__ attribute for the
instance you're renaming, it can't find one.

I'm way out of my depth here, but I can get it to work again by adding
to the function PersistentClassDict() in lib/python/ZClasses/
(line 195 or so):


so that it looks like this:

def PersistentClassDict(doc=None, meta_type=None):
        # Build new class dict
        if meta_type is not None:
        if doc is not None:
        return dict

This only works for ZClasses defined after the change, though.

I have absolutely no idea what the side-effects of this change are, and
I'm not even entirely sure what it does :-)

It seems to fix the problems of renaming DataSkin-derived ZClasses too.

I've looked though the recent CVS checkins, and I can't see a fix for
this yet. I've also looked through the Collector, and I can't see this
problem reported.

Steve Alexander
Software Engineer
Cat-Box limited

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to