[Zope] __bobo_traverse__ help

Garito garito at sistes.net
Fri Nov 10 15:23:33 EST 2006


Dieter Maurer escribió:
> 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).
>
>
>
>   
Hi!
Perfect, that's what I need (I hope so :-) )

Thank you so much, I try it!

-- 
Mis Cosas
http://blogs.sistes.net/Garito




More information about the Zope mailing list