Hi!<br>Some one could help me to construct a correct __bobo_traverse__ or wrapper for my necesities.<br><br>The clues:<br><br>I have this model of __bobo_traverse__:<br><br>def __bobo_traverse__(self, REQUEST, nombre):<br>
obj = getattr(self, nombre, None)<br> if obj is None: <br> self.REQUEST.set('TraversalRequestNameStack', self.REQUEST["TraversalRequestNameStack"] + [nombre])<br> if hasattr(self, '
index.html'): return getattr(self, 'index.html')<br> else:<br> resultado = self.__call__()<br> if type(resultado) == type(unicode()): return WrapperUnicode(resultado)<br>
elif type(resultado) == type(str()): return WrapperStr(resultado)<br> elif type(resultado) == type(dict()): return WrapperDict(resultado)<br> else: return resultado<br> return obj
<br><br>With this Wrapper classes:<br><br>class WrapperStr(str):<br> """ """<br> __roles__ = None<br> <br> def __bobo_traverse__(self, REQUEST, nombre):<br> obj = getattr(self, nombre, None)
<br> if obj is None: return self<br> else: return obj<br> <br>class WrapperUnicode(unicode):<br> """ """<br> __roles__ = None<br> <br> def __init__(self, cadena):
<br> self.cadena = cadena<br> <br> def __bobo_traverse__(self, REQUEST, nombre):<br> obj = getattr(self, nombre, None)<br> if obj is None: return self<br> else: return obj.__of__(self)<br>
<br> def __call__(self):<br> return self.cadena<br> <br> def __str__(self):<br> return str(self.cadena.decode('latin-1'))<br><br>class WrapperDict(dict):<br> """ """
<br> __roles__ = None<br> <br> def __bobo_traverse__(self, REQUEST, nombre):<br> obj = getattr(self, nombre, None)<br> if obj is None: return self<br> else: return obj<br><br>With this version I have the security problem I'm asking this days. The last opinion was the Wrapper classes are the problem but you could see the wrappers I can do with the information I have
<br><br>But if I change the __bobo_traverse__ to this:<br><br>def __bobo_traverse__(self, REQUEST, nombre):<br> obj = getattr(self, nombre, None)<br> if obj is None: <br> self.REQUEST.set('TraversalRequestNameStack',
self.REQUEST["TraversalRequestNameStack"] + [nombre])<br> if hasattr(self, 'index.html'): return getattr(self, 'index.html')<br> else:<br> obj = getattr(self, 'lanzador', None)
<br> return obj<br><br>Where lanzador is a page template with this code:<br><br><tal:b tal:replace='structure here' /><br><br>Then it works perfect!! (we can conclude, then, that Martijn has good clues about the problem, thanks again!)
<br><br>Here my petition of help:<br><br>Could someone explain or point me to how the wrappers need to be? I don't like so much the idea that all my work depends on a page template with 1 line of code if I could implement it at product code
<br><br>Thank you!<br clear="all"><br>-- <br>Mis Cosas<br><a href="http://blogs.sistes.net/Garito">http://blogs.sistes.net/Garito</a>