contrib/nmbug/nmbug-status: if realname empty, use part of mailaddr
authorTomi Ollila <tomi.ollila@iki.fi>
Fri, 24 Aug 2012 17:29:21 +0000 (20:29 +0300)
committerDavid Bremner <bremner@debian.org>
Sun, 2 Sep 2012 01:58:49 +0000 (22:58 -0300)
When the From: field in patch email does not contain 'realname'
field, the patch listing does not show anything as patch sender.
In this case use the part before '@' in mail address as the sender
identification in patch listing.

contrib/nmbug/nmbug-status

index f37ee84bb301895288ba6c68237b713ffb384dd2..9a334cccf39064aa4c26c358af7493b4f1a9be8e 100755 (executable)
@@ -90,7 +90,9 @@ def print_view(title, query, comment):
                 val = str.join(' ', val.split(None)[1:4])
                 val = str(datetime.datetime.strptime(val, '%d %b %Y').date())
             elif header == 'from':
-                val = rfc822.parseaddr(val)[0]
+                (val, addr) = rfc822.parseaddr(val)
+                if val == '':
+                    val = addr.split('@')[0]
 
             if last[header] == val:
                 out[header] = ''