Quoting Tomi Ollila (2011-12-14 13:26:38) >On Wed, 14 Dec 2011 11:58:24 +0100, Justus Winter <4winter@informatik.uni-hamburg.de> wrote: >> --- >[ ... snip ... ] > >> >> -class Filenames(object): >> +class Filenames(Python3StringMixIn): >> """Represents a list of filenames as returned by notmuch >> >> This object contains the Filenames iterator. The main function is >> @@ -98,9 +98,6 @@ class Filenames(object): >> >> self._files = None >> >> - def __str__(self): >> - return unicode(self).encode('utf-8') >> - >> def __unicode__(self): >> """Represent Filenames() as newline-separated list of full paths >> >> diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py >> index c52790c..2111b86 100644 >> --- a/bindings/python/notmuch/globals.py >> +++ b/bindings/python/notmuch/globals.py >> @@ -28,6 +28,16 @@ except: >> raise ImportError("Could not find shared 'notmuch' library.") >> >> >> +if sys.version_info[0] == 2: >> + class Python3StringMixIn(object): >> + def __str__(self): >> + return unicode(self).encode('utf-8') >> +else: >> + class Python3StringMixIn(object): >> + def __str__(self): >> + return self.__unicode__() >> + >> + > >[ ... snip ... ] > >> -class Threads(object): >> +class Threads(Python3StringMixIn): >> """Represents a list of notmuch threads >> >> This object provides an iterator over a list of notmuch threads >> @@ -393,7 +393,7 @@ class Thread(object): >> return Tags(tags_p, self) >> >> def __str__(self): >> - return unicode(self).encode('utf-8') >> + return self.__unicode__().encode('utf-8') >> >> def __unicode__(self): >> frm = "thread:%s %12s [%d/%d] %s; %s (%s)" > >Is this class special case ? in all other classes >the __str__() function has been removed (using inherited >function) ? Damn, I missed that one... that was my first approach but that obviously didn't worked out... I'll send an updated patch. >Otherwise LGTM -- pretty simple and effective (all 7 patches). Thanks :) Note that I do not know how complete the port is. But the stuff used by my tagging application (afew) works. Justus