<html><body>On 08:19 pm, cedepaula@yahoo.com.br wrote:<br />&gt;Jean-Paul Calderone &lt;exarkun &lt;at&gt; divmod.com&gt; writes:<br />&gt;<br />&gt;&gt;<br />&gt;&gt; You have to re-implement the login process to support anonymous users.<br />&gt;&gt;<br />&gt;&gt; PBClientFactory.login() cannot be used for this.<br />&gt;&gt;<br />&gt;&gt; Jean-Paul<br />&gt;&gt;<br />&gt;<br />&gt;So, the examples given in<br />&gt;http://twistedmatrix.com/projects/core/documentation/howto/pb-cred.html (below)<br />&gt;doesnt works?<br />&gt;<br />&gt;# anonymous users share one Avatar, named users each get their own<br />&gt; &#160; &#160;def requestAvatar(self, avatarID, mind, *interfaces):<br />&gt; &#160; &#160; &#160; &#160;assert pb.IPerspective in interfaces<br />&gt; &#160; &#160; &#160; &#160;if avatarID == checkers.ANONYMOUS:<br />&gt; &#160; &#160; &#160; &#160; &#160; &#160;return pb.IPerspective, self.anonAvatar, lambda:None<br />&gt; &#160; &#160; &#160; &#160;else:<br />&gt; &#160; &#160; &#160; &#160; &#160; &#160;return pb.IPerspective, self.avatars[avatarID], lambda:None<br /><br />Yes, unfortunately. &#160;Without changing protocol-level code in PB, there is<br />no way the first branch in that if/else is ever going to be executed. I'm<br />not sure why the example bothers to cover this case; it seems misleading.<br /><br />&gt;<br />&gt;I was looking at pb.py, portal.py and the way i understood, the whole chain<br />&gt;(login -&gt; cbSendUsername -&gt; remote login -&gt; cb_Response -&gt; remote respond) is<br />&gt;the responsible by the login process... if we send like credentials.Anonymous in<br />&gt;login(), all this chain needs to handle it... right?<br /><br />Yes, that is correct. &#160;Despite the number of steps involved, it's actually<br />not very much work to adjust.<br /><br />&gt;<br />&gt;Its a little strange why we cant have authenticated and anonymous users sharing<br />&gt;the same process since we can filter in the avatar given the permissions (like<br />&gt;example above).<br /><br />It's an unfortunate omission. &#160;Requests for PB logins using a different<br />kind of credentials object are fairly common.<br /><br />&gt;<br />&gt;Another question... is it interesting to twisted project to have this kind of<br />&gt;support? I mean, is it important to provide a way to this support in a patch to<br />&gt;the project or should I do modifications I need (if i learn how to) and keep<br />&gt;them to me?<br /><br />It would be a very welcome contribution. :) &#160;Take a look at these pages,<br />if you haven't already seen them, for some guidelines on how to best<br />contribute the changes, and feel free to ask if you have any other questions.<br /><br />Jean-Paul<br /></body></html>