Skip to content

Commit 92f9eb7

Browse files
authored
Merge pull request #86 from mawildoer/mawildoer/property-generators
Let properties be generators too
2 parents c004bbc + 5b1db99 commit 92f9eb7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Pyro5/server.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,16 @@ def handleRequest(self, conn):
456456
if method == "__getattr__":
457457
# special case for direct attribute access (only exposed @properties are accessible)
458458
data = _get_exposed_property_value(obj, vargs[0])
459+
if not request_flags & protocol.FLAGS_ONEWAY:
460+
isStream, data = self._streamResponse(data, conn)
461+
if isStream:
462+
# throw an exception as well as setting message flags
463+
# this way, it is backwards compatible with older pyro versions.
464+
exc = errors.ProtocolError("result of call is an iterator")
465+
ann = {"STRM": data.encode()} if data else {}
466+
self._sendExceptionResponse(conn, request_seq, serializer.serializer_id, exc, None,
467+
annotations=ann, flags=protocol.FLAGS_ITEMSTREAMRESULT)
468+
return
459469
elif method == "__setattr__":
460470
# special case for direct attribute access (only exposed @properties are accessible)
461471
data = _set_exposed_property_value(obj, vargs[0], vargs[1])

0 commit comments

Comments
 (0)