|
|
@@ -91,6 +91,20 @@ def serializer_proxy(obj_or_type): |
|
|
|
r = SerializerCallProxy(self.__call_queue, attr, self) |
|
|
|
return r |
|
|
|
|
|
|
|
# For an interable object, on __iter__(), save the object's |
|
|
|
# iterator and return this proxy. On next(), call the object's |
|
|
|
# iterator through this proxy. |
|
|
|
def __iter__(self): |
|
|
|
attr = getattr(self.__object, "__iter__") |
|
|
|
self.__iter = SerializerCallProxy(self.__call_queue, attr, self)() |
|
|
|
return self |
|
|
|
def next(self): |
|
|
|
return SerializerCallProxy(self.__call_queue, |
|
|
|
self.__iter.next, self)() |
|
|
|
|
|
|
|
def __getitem__(self, key): |
|
|
|
return self.__getattr__("__getitem__")(key) |
|
|
|
|
|
|
|
def __call__(self, *args, **kwargs): |
|
|
|
"""Call this to instantiate the type, if a type was passed |
|
|
|
to serializer_proxy. Otherwise, pass the call through.""" |
|
|
|