Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 49016429E28 for ; Mon, 5 Dec 2011 13:20:19 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qaYgllUu-8Cc for ; Mon, 5 Dec 2011 13:20:18 -0800 (PST) Received: from mail-ey0-f181.google.com (mail-ey0-f181.google.com [209.85.215.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 99EF9429E26 for ; Mon, 5 Dec 2011 13:20:18 -0800 (PST) Received: by eaal13 with SMTP id l13so1424321eaa.26 for ; Mon, 05 Dec 2011 13:20:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=7YueAhZDri1IIAr1ogXZJp5B0szEyTtOJkj+r6/M8ZQ=; b=P44LuFsg+CvnVf8zc/HuYdaJHk/UJypFWg7xI9tq49jInYcTZ/9v27e2rPkJFJASRh cactxQRhE7AoLBaJiyEyASjJ/XHNUHtsbLI3U39MpVQd+0H9BCUGgs2djojKRnAcrQDb wmOND+RvTJdqakY+Sh4Lll/0863nguZXJCoEU= Received: by 10.213.7.71 with SMTP id c7mr1397922ebc.83.1323119978641; Mon, 05 Dec 2011 13:19:38 -0800 (PST) Received: from localhost (cpc1-sgyl2-0-0-cust548.18-2.cable.virginmedia.com. [82.41.10.37]) by mx.google.com with ESMTPS id 17sm52007892eej.3.2011.12.05.13.19.36 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 05 Dec 2011 13:19:37 -0800 (PST) From: Patrick Totzke To: notmuch@notmuchmail.org Subject: [PATCH 1/3] clean up Thread.__str__ Date: Mon, 5 Dec 2011 21:19:27 +0000 Message-Id: <1323119969-1485-2-git-send-email-patricktotzke@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1323119969-1485-1-git-send-email-patricktotzke@gmail.com> References: <1323119969-1485-1-git-send-email-patricktotzke@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 21:20:19 -0000 --- bindings/python/notmuch/thread.py | 37 +++++++++++++------------------------ 1 files changed, 13 insertions(+), 24 deletions(-) diff --git a/bindings/python/notmuch/thread.py b/bindings/python/notmuch/thread.py index d903c76..3e59b35 100644 --- a/bindings/python/notmuch/thread.py +++ b/bindings/python/notmuch/thread.py @@ -393,30 +393,19 @@ class Thread(object): return Tags(tags_p, self) def __str__(self): - """A str(Thread()) is represented by a 1-line summary""" - thread = {} - thread['id'] = self.get_thread_id() - - ###TODO: How do we find out the current sort order of Threads? - ###Add a "sort" attribute to the Threads() object? - #if (sort == NOTMUCH_SORT_OLDEST_FIRST) - # date = notmuch_thread_get_oldest_date (thread); - #else - # date = notmuch_thread_get_newest_date (thread); - thread['date'] = date.fromtimestamp(self.get_newest_date()) - thread['matched'] = self.get_matched_messages() - thread['total'] = self.get_total_messages() - thread['authors'] = self.get_authors() - thread['subject'] = self.get_subject() - thread['tags'] = self.get_tags() - - return "thread:%s %12s [%d/%d] %s; %s (%s)" % (thread['id'], - thread['date'], - thread['matched'], - thread['total'], - thread['authors'], - thread['subject'], - thread['tags']) + return unicode(self).encode('utf-8') + + def __unicode__(self): + frm = "thread:%s %12s [%d/%d] %s; %s (%s)" + + return frm % (self.get_thread_id(), + date.fromtimestamp(self.get_newest_date()), + self.get_matched_messages(), + self.get_total_messages(), + self.get_authors(), + self.get_subject(), + self.get_tags(), + ) _destroy = nmlib.notmuch_thread_destroy _destroy.argtypes = [NotmuchThreadP] -- 1.7.4.1