{"thread":{"id":"3607","subject":"[stgit] [PATCH] common: parse 'email (name)' correctly","startedAt":"2006-03-09T05:29:58Z","lastAt":"2006-03-09T05:29:58Z","messageCount":1,"participants":["Sam Vilain"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"17357","messageId":"440FBD56.1040007@vilain.net","threadId":"3607","inReplyTo":null,"subject":"[stgit] [PATCH] common: parse 'email (name)' correctly","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2006-03-09T05:29:58Z","receivedAt":"2006-03-09T05:29:58Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Currently only e-mails of the form \"Name <email>\" are accepted by\nstgit import etc, however some people use \"email (Name)\".  Accept this\nalternate form.\n---\nNote: the function just below it might need consideration, too.\n\n stgit/commands/common.py |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/stgit/commands/common.py b/stgit/commands/common.py\nindex 2985379..4bfa4dd 100644\n--- a/stgit/commands/common.py\n+++ b/stgit/commands/common.py\n@@ -175,12 +175,15 @@ def push_patches(patches, check_merged =\n \n def name_email(address):\n     \"\"\"Return a tuple consisting of the name and email parsed from a\n-    standard 'name <email>' string\n+    standard 'name <email>' or 'email (name)' string\n     \"\"\"\n     address = re.sub('[\\\\\\\\\"]', '\\\\\\\\\\g<0>', address)\n     str_list = re.findall('^(.*)\\s*<(.*)>\\s*$', address)\n     if not str_list:\n-        raise CmdException, 'Incorrect \"name <email>\" string: %s' % address\n+        str_list = re.findall('^(.*)\\s*\\((.*)\\)\\s*$', address)\n+        if not str_list:\n+            raise CmdException, 'Incorrect \"name <email>\"/\"email\n(name)\" string: %s' % address\n+        return ( str_list[0][1], str_list[0][0] )\n \n     return str_list[0]\n"}]}