isproxy missing?

2 views
Skip to first unread message

wsvoorhees

unread,
Nov 19, 2008, 2:02:05 PM11/19/08
to rpyc
I have a use case where I think this isproxy command that was
apparently part of the 2.60 release would be very helpful, however it
seems that this command is no longer included (fgrep isproxy -R *
shows up nothing) Perhaps it was omitted because there is a better
mechanism in place now?

Here's what I'm trying to do:

Server:
import rpyc
class SomeService(rpyc.Service):
"This class holds a dictionary that contains images"
def on_connect(self):
self.images = {}

if __name__ == "__main__":
from rpyc.utils.server import ThreadedServer
s = ThreadedServer(SomeService, port = 18861)
s.start()


Client:

import rpyc
import Image
c = rpyc.connect("localhost", 18861)
o = c.root
bike_image = Image.open("bicycle.png")
o.images['bike_image'] = bike_image



However, in this case images[bike_image] is a proxy object, but I want
to force it to be a real object on the server, and a proxy object on
the client. To accomplish this goal, I think I'm going to impliment a
dictionary class that overrides the __setattr__ to insist that it gets
a real object and not a proxy object. Is there a better way to do
this?

-Will

tomer filiba

unread,
Nov 19, 2008, 3:03:32 PM11/19/08
to rp...@googlegroups.com
hi

isproxy is no longer supported. if your code wishes to be proxy-aware, you can simply use isinstance:

isinstance(x, rpyc.BaseNetref)


-tomer
--
An NCO and a Gentleman
Reply all
Reply to author
Forward
0 new messages