Example #1
0
 def _box(self, obj):
     if orig_isinstance(obj, simple_types):
         return TYPE_SIMPLE, obj
     elif orig_isinstance(obj, slice):
         return TYPE_SLICE, (obj.start, obj.stop, obj.step)
     elif orig_isinstance(obj, NetProxy) and _get_conn(obj) is self.conn:
         return TYPE_LOCAL_PROXY, _get_oid(obj)
     elif orig_isinstance(obj, tuple):
         if obj:
             return TYPE_TUPLE, [self._box(subobj) for subobj in obj]
         else:
             return TYPE_SIMPLE, ()
     elif orig_isinstance(obj, ImmDict):
         if not obj.dict:
             return TYPE_SIMPLE, {}
         else:
             return TYPE_IMMDICT, [(self._box(k), self._box(v)) for k, v in obj.items()]
     else:
         oid = id(obj)
         self.objects.setdefault(oid, [0, obj])[0] += 1
         return TYPE_PROXY, oid
Example #2
0
 def __request__(self, handler, *args):
     res = AsyncResult(_get_conn(self))
     _get_conn(self).async_request(res.callback, handler, _get_oid(self),
                                   *args)
     return res
Example #3
0
 def __request__(self, handler, *args):
     res = AsyncResult(_get_conn(self))
     _get_conn(self).async_request(res.callback, handler, _get_oid(self), *args)
     return res
 def __request__(self, handler, *args):
     return _get_conn(self).sync_request(handler, _get_oid(self), *args)
Example #5
0
 def __request__(self, handler, *args):
     return _get_conn(self).sync_request(handler, _get_oid(self), *args)