Wow! Now I' more confused than before I create WrapperStr class because the __bobo_traverse__ of my product has problems to return a str But when I try to use it it has an error (I don't remember what, sorry) that dissapears when I create the wrapper's __bobo_traverse__. I copy the behavior from my product's __bobo_traverse__ (I don't know so much what I'm doing I confess) Then my wrapper is an intuitive wrapper Can you lighten about how need to construct a good wrapper? Thanks! 2007/3/23, Martijn Pieters <mj@zopatista.com>:
On 3/23/07, Garito <garito@sistes.net> wrote:
I don't know if I understand what you say This is the code of one of my wrappers (str one):
class WrapperStr(str): """ """ __roles__ = None
def __bobo_traverse__(self, REQUEST, nombre): obj = getattr(self, nombre, None) if obj is None: return self else: return obj
What kind of object is obj? It should probably be acquisition wrapped (return obj.__of__(self).
How could be the __call__? like:
def __call__(self): return <what to return here?>
The object returned from __bobo_traverse__ will be called by the publisher, so *it* needs to implement __call__, but index_html and __str__ may also do.
-- Martijn Pieters
-- Mis Cosas http://blogs.sistes.net/Garito