[Twisted-Python] perspective argument missing from Viewable.view_*
Daniel Sank
sank.daniel at gmail.com
Mon Nov 18 23:12:02 MST 2013
>> Client then have to authenticate to the server, only then you will receive
>> the perspective object representing the "logged" user into your
> view_ and perspective_ method.
> I am confused by this. When I use the cred system the client gets a
> remote reference to an Avatar on which it can call perspective_*
> methods. How does this translate into having the proper perspective
> passed into calls to view_* methods on other objects?
I figured out what's going on. If I send a Viewable to the client like this:
myAvatar.mind.callRemote("takeViewable", instanceOfViewable)
then the client's subsequent calls to the viewable arrive with the
perspective argument set to None. It seems that to make Viewable work
properly I have return the Viewable instance from a perspective_*
method on the Avatar. For example
class MyAvatar(pb.Avatar):
perspective_getViewable(self):
...
return instanceOfViewable
This is not indicated in the documentation. I looked into fixing it
myself but it seems there's somewhat of an activation barrier in
submitting documentation fixes. Hopefully I will climb over that
barrier soon.
This raises the question of how to enable a single human with a single
connection to act as more than one client in a pb managed system.
Regards,
Daniel Sank
More information about the Twisted-Python
mailing list