I don&#39;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>&nbsp;&nbsp;&nbsp; &quot;&quot;&quot; &quot;&quot;&quot;<br>&nbsp;&nbsp;&nbsp; __roles__ = None<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; def __bobo_traverse__(self, REQUEST, nombre):
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; obj = getattr(self, nombre, None)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if obj is None: return self<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else: return obj<br><br>How could be the __call__? like:<br><br>def __call__(self):<br>&nbsp; return &lt;what to return here?&gt;<br>
<br>Thanks!<br><br><div><span class="gmail_quote">2007/3/23, Martijn Pieters &lt;<a href="mailto:mj@zopatista.com">mj@zopatista.com</a>&gt;:</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>&gt;&gt; &gt; If you read the link I put, you could read I can create (with<br>&gt;&gt; &gt; CrearFuncionalidad) but not delete it (with BorrarFuncionalidad)
<br>&gt;&gt; that seems<br>&gt;&gt; &gt; to have the same security necessities<br>&gt;&gt;<br>&gt;&gt; Return a callable from your traverser (so return the __call__, don&#39;t<br>&gt;&gt; call it yourself). The publisher will call it for you after the user
<br>&gt;&gt; has been authenticated.<br>&gt;<br>&gt; As Dieter said __bobo_traverse__ can&#39;t return strings or ints for<br>&gt; that I create (as he tall me, thanks again) a wrapper that returns<br>&gt; the rendered code
<br><br>Fine, that&#39;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>&nbsp;&nbsp;&nbsp;&nbsp; def __call__(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Things that need a security context need to be done here.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return getSecurityManager().getAuthenticatedUser().getId()
<br><br>class SomeItem(SimpleItem):<br>&nbsp;&nbsp;&nbsp;&nbsp; def __bobo_traverse__(self, REQUEST, name):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if name == &#39;Wrapper&#39;:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return Wrapper().__of__(self)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>