[Zope] __bobo_traverse__ help

Dieter Maurer dieter at handshake.de
Fri Nov 10 14:57:52 EST 2006


Garito wrote at 2006-11-10 15:00 +0100:
> ...
>> You may try to return a wrapper that behaves the same way
>> as the original object (by deriving from the respective type)
>> but has "__roles__ = None" as additional attribute (which declares
>> the object public).
>>
>>
>>
>>   
>Uau!
>Can you point me to a simple example or similar? I'm not sure if I 
>understand what you are telling me

Here is a wrapper for the "str" type:

   class WrappedStr(str):
     __roles__ = None

Instead of returning "some_str" you would return "WrappedStr(some_str)".

The "__roles__ = None" tells the Zope security machinery that
the object is public.

"WrappedStr(some_str)" would almost behave like "some_str" (but
of course not completely).



-- 
Dieter


More information about the Zope mailing list