]> git.notmuchmail.org Git - notmuch/commit - bindings/python/notmuch/message.py
python: make the result of Message.get_replies() more pythonic
authorJustus Winter <4winter@informatik.uni-hamburg.de>
Wed, 21 Dec 2011 13:15:02 +0000 (14:15 +0100)
committerSebastian Spaeth <Sebastian@SSpaeth.de>
Mon, 2 Jan 2012 16:01:40 +0000 (17:01 +0100)
commitada246aa20c2f9b1e225bc50865e208d03296fc0
tree7b70e177bf8d404c1b5b68a589c6f50d14ed89fd
parente32c8a5e6bcc7bdbf5e1a5800ac42e25dc8ca70e
python: make the result of Message.get_replies() more pythonic

Formerly Message.get_replies() returned an iterator or None forcing
users to check the result before iterating over it leading to strange
looking code at the call site.

Fix this flaw by adding an EmptyMessagesResult class that behaves like
the Messages class but immediatly raises StopIteration if used as an
iterator and returning objects of this type from Message.get_replies()
to indicate that there are no replies.
bindings/python/notmuch/message.py