Returning just the name on the email lookup function

This commit is contained in:
Sergio Durigan Junior 2016-09-19 23:36:45 -04:00
parent 0099617bf8
commit 5cb3e0ee48

View file

@ -572,18 +572,7 @@ class LookupEmailTryBuild (object):
implements (IEmailLookup)
def getAddress (self, name):
# List of [ dir, sorted_reverse ]
tryjobdir = [ [ os.path.expanduser ("~/gdb/try_ssh_jobdir/new/"), False ],
[ os.path.expanduser ("~/gdb/try_ssh_jobdir/cur/"), True ] ]
name_re = re.compile (".*(%s <(.*@.*)>),.*" % name, flags = re.UNICODE)
for directory, sort_order in tryjobdir:
for _, _, filenames in os.walk (directory):
for f in sorted (filenames, reverse = sort_order):
with open (os.path.join (directory, f), 'r') as myf:
for line in reversed (myf.readlines ()):
m = re.match (name_re, line)
if m:
return m.group (2)
return name
mn_try = MyMailNotifier(fromaddr = GDB_MAIL_FROM,
sendToInterestedUsers = True,