Re: [python] get all messages of a thread

2011-06-02 Thread Sebastian Spaeth
On Wed, 1 Jun 2011 15:35:35 +1000, Brian May wrote: Oh, I see, for your code, there is a implied call to __len__, and the __len__ function is completely broken for the reasons described in the documentation: It seems to have been a bad idea to implement __len__ at all for the Messsages()

Re: [python] get all messages of a thread

2011-06-02 Thread Brian May
On 2 June 2011 17:05, Sebastian Spaeth sebast...@sspaeth.de wrote: What would be the best way to solve this (besides fixing the C api to allow to reset the iterator ;-) ?) I am not really familiar with the code. So am I correct in making the following assumptions? * It is not easy to fix

Re: [python] get all messages of a thread

2011-06-02 Thread Sebastian Spaeth
On Thu, 2 Jun 2011 19:43:29 +1000, Brian May wrote: On 2 June 2011 17:05, Sebastian Spaeth sebast...@sspaeth.de wrote: What would be the best way to solve this (besides fixing the C api to allow to reset the iterator ;-) ?) * It is not easy to fix the C api to reset the iterator (what

Re: [python] get all messages of a thread

2011-06-02 Thread Sebastian Spaeth
On Thu, 02 Jun 2011 16:20:14 +0200, Sebastian Spaeth wrote: I made the change, and implemented __nonzero__ and removed the len() method. It just doesn't make sense on 1-time iterators. (I documented the change in the API docs). Sorry if this breaks existing code. FYI OK, I just pushed a

Re: [python] get all messages of a thread

2011-06-02 Thread Austin Clements
On Thu, Jun 2, 2011 at 10:20 AM, Sebastian Spaeth sebast...@sspaeth.de wrote: On Thu, 2 Jun 2011 19:43:29 +1000, Brian May wrote: On 2 June 2011 17:05, Sebastian Spaeth sebast...@sspaeth.de wrote: What would be the best way to solve this (besides fixing the C api to allow to reset the

Re: [python] get all messages of a thread

2011-05-31 Thread Carl Worth
On Sat, 28 May 2011 14:18:05 +0100, Patrick Totzke patricktot...@googlemail.com wrote: It seems that nobody needed this before. Even in bindings/python/notmuch.py only Threads.get_toplevel_messages() gets called, and then a (undocumented) Messages.print_messages is used (cf line 639, in show)

Re: [python] get all messages of a thread

2011-05-31 Thread Brian May
On 28 May 2011 23:18, Patrick Totzke patricktot...@googlemail.com wrote: if r: #because we cant iterate on NoneType I don't understand why, but this line sets r._msgs to None. So it crashes, because it has no message ids to look for. If you change it to if r is not None: ... then it