<html><body>On 08:19 pm, cedepaula@yahoo.com.br wrote:<br />>Jean-Paul Calderone <exarkun <at> divmod.com> writes:<br />><br />>><br />>> You have to re-implement the login process to support anonymous users.<br />>><br />>> PBClientFactory.login() cannot be used for this.<br />>><br />>> Jean-Paul<br />>><br />><br />>So, the examples given in<br />>http://twistedmatrix.com/projects/core/documentation/howto/pb-cred.html (below)<br />>doesnt works?<br />><br />># anonymous users share one Avatar, named users each get their own<br />>    def requestAvatar(self, avatarID, mind, *interfaces):<br />>        assert pb.IPerspective in interfaces<br />>        if avatarID == checkers.ANONYMOUS:<br />>            return pb.IPerspective, self.anonAvatar, lambda:None<br />>        else:<br />>            return pb.IPerspective, self.avatars[avatarID], lambda:None<br /><br />Yes, unfortunately.  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 />><br />>I was looking at pb.py, portal.py and the way i understood, the whole chain<br />>(login -> cbSendUsername -> remote login -> cb_Response -> remote respond) is<br />>the responsible by the login process... if we send like credentials.Anonymous in<br />>login(), all this chain needs to handle it... right?<br /><br />Yes, that is correct.  Despite the number of steps involved, it's actually<br />not very much work to adjust.<br /><br />><br />>Its a little strange why we cant have authenticated and anonymous users sharing<br />>the same process since we can filter in the avatar given the permissions (like<br />>example above).<br /><br />It's an unfortunate omission.  Requests for PB logins using a different<br />kind of credentials object are fairly common.<br /><br />><br />>Another question... is it interesting to twisted project to have this kind of<br />>support? I mean, is it important to provide a way to this support in a patch to<br />>the project or should I do modifications I need (if i learn how to) and keep<br />>them to me?<br /><br />It would be a very welcome contribution. :)  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>