Skip to content
This repository has been archived by the owner on Apr 19, 2019. It is now read-only.

Commit

Permalink
Use next() with default instead of confusing errback
Browse files Browse the repository at this point in the history
  • Loading branch information
kxz committed Aug 5, 2015
1 parent 0dcfcf2 commit 8c77d9b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions omnipresence/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,7 @@ def reply_from_buffer(self, request, reply_when_empty=False):
' (+{} more characters)').format(remaining_chars)
deferred = succeed(next_reply)
else: # assume an iterator
deferred = maybeDeferred(next, buf)
# Return None on StopIteration. It looks weird, yes.
deferred.addErrback(lambda f: f.trap(StopIteration) and None)
deferred = maybeDeferred(next, buf, None)
if reply_when_empty:
deferred.addCallback(lambda s: s or 'No text in buffer.')
deferred.addCallback(self.reply, request)
Expand Down

0 comments on commit 8c77d9b

Please sign in to comment.