I don't know if I understand what you say<br>This is the code of one of my wrappers (str one):<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>How could be the __call__? like:<br><br>def __call__(self):<br> return <what to return here?><br>
<br>Thanks!<br><br><div><span class="gmail_quote">2007/3/23, Martijn Pieters <<a href="mailto:mj@zopatista.com">mj@zopatista.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Please keep the mailing list in the loop, others may have insights too.<br><br>On 23. mar. 2007, at 15.37, Garito wrote:<br>>> > If you read the link I put, you could read I can create (with<br>>> > CrearFuncionalidad) but not delete it (with BorrarFuncionalidad)
<br>>> that seems<br>>> > to have the same security necessities<br>>><br>>> Return a callable from your traverser (so return the __call__, don't<br>>> call it yourself). The publisher will call it for you after the user
<br>>> has been authenticated.<br>><br>> As Dieter said __bobo_traverse__ can't return strings or ints for<br>> that I create (as he tall me, thanks again) a wrapper that returns<br>> the rendered code
<br><br>Fine, that's what I ment. But your wrapper should implement a<br>__call__ method. The publisher will call that method at a time where<br>security *has* been set up.<br><br>Do make sure that you wrap your wrapper in the correct security
<br>context though:<br><br>class Wrapper(Acquisition.Implicit):<br> def __call__(self):<br> # Things that need a security context need to be done here.<br> return getSecurityManager().getAuthenticatedUser().getId()
<br><br>class SomeItem(SimpleItem):<br> def __bobo_traverse__(self, REQUEST, name):<br> if name == 'Wrapper':<br> return Wrapper().__of__(self)<br> else:<br> return getattr(self, name)
<br><br>This way the security policies can still look up the security context.<br><br>--<br>Martijn Pieters<br></blockquote></div><br><br clear="all"><br>-- <br>Mis Cosas<br><a href="http://blogs.sistes.net/Garito">http://blogs.sistes.net/Garito
</a>