mirror of
https://github.com/python/cpython.git
synced 2025-10-07 15:42:02 +00:00
The remote procedure call module rpc.py can now access data attributes of
remote registered objects. Changes to these attributes are local, however. M EditorWindow.py M NEWS.txt M PyShell.py M idlever.py M rpc.py M run.py
This commit is contained in:
parent
f654c1c383
commit
dcba6622f5
6 changed files with 23 additions and 11 deletions
|
@ -121,7 +121,7 @@ request_queue = Queue.Queue(0)
|
|||
response_queue = Queue.Queue(0)
|
||||
|
||||
|
||||
class SocketIO:
|
||||
class SocketIO(object):
|
||||
|
||||
nextseq = 0
|
||||
|
||||
|
@ -475,7 +475,7 @@ class SocketIO:
|
|||
|
||||
#----------------- end class SocketIO --------------------
|
||||
|
||||
class RemoteObject:
|
||||
class RemoteObject(object):
|
||||
# Token mix-in class
|
||||
pass
|
||||
|
||||
|
@ -484,7 +484,7 @@ def remoteref(obj):
|
|||
objecttable[oid] = obj
|
||||
return RemoteProxy(oid)
|
||||
|
||||
class RemoteProxy:
|
||||
class RemoteProxy(object):
|
||||
|
||||
def __init__(self, oid):
|
||||
self.oid = oid
|
||||
|
@ -533,7 +533,7 @@ class RPCClient(SocketIO):
|
|||
def get_remote_proxy(self, oid):
|
||||
return RPCProxy(self, oid)
|
||||
|
||||
class RPCProxy:
|
||||
class RPCProxy(object):
|
||||
|
||||
__methods = None
|
||||
__attributes = None
|
||||
|
@ -549,7 +549,11 @@ class RPCProxy:
|
|||
return MethodProxy(self.sockio, self.oid, name)
|
||||
if self.__attributes is None:
|
||||
self.__getattributes()
|
||||
if not self.__attributes.has_key(name):
|
||||
if self.__attributes.has_key(name):
|
||||
value = self.sockio.remotecall(self.oid, '__getattribute__',
|
||||
(name,), {})
|
||||
return value
|
||||
else:
|
||||
raise AttributeError, name
|
||||
|
||||
def __getattributes(self):
|
||||
|
@ -579,7 +583,7 @@ def _getattributes(obj, attributes):
|
|||
if not callable(attr):
|
||||
attributes[name] = 1
|
||||
|
||||
class MethodProxy:
|
||||
class MethodProxy(object):
|
||||
|
||||
def __init__(self, sockio, oid, name):
|
||||
self.sockio = sockio
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue