From f53420e347cd63d25441c772bfaee9c583df0b3e Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 12 Oct 2012 13:21:21 -0400 Subject: [PATCH] Clean up fullname detection for special domains. (imported from commit 92450b37b8749d52a5322306e9475e8189ccfd89) --- zephyr_mirror.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/zephyr_mirror.py b/zephyr_mirror.py index f24ad81..a8ee7ae 100644 --- a/zephyr_mirror.py +++ b/zephyr_mirror.py @@ -94,18 +94,17 @@ def fetch_fullname(username): print >>sys.stderr, 'Error getting fullname for', username traceback.print_exc() - if username.upper().endswith("@CS.CMU.EDU"): - return username.split("@")[0] + " (CMU)" - if username.upper().endswith("@ANDREW.CMU.EDU"): - return username.split("@")[0] + " (CMU)" - if username.upper().endswith("@IASTATE.EDU"): - return username.split("@")[0] + " (IASTATE)" - if username.upper().endswith("@1TS.ORG"): - return username.split("@")[0] + " (1TS)" - if username.upper().endswith("@DEMENTIA.ORG"): - return username.split("@")[0] + " (DEMENTIA)" - if username.upper().endswith("MIT.EDU"): - return username.split("@")[0] + domains = [ + ("@CS.CMU.EDU", " (CMU)"), + ("@ANDREW.CMU.EDU", " (CMU)"), + ("@IASTATE.EDU", " (IASTATE)"), + ("@1TS.ORG", " (1TS)"), + ("@DEMENTIA.ORG", " (DEMENTIA)"), + ("@MIT.EDU", ""), + ] + for (domain, tag) in domains: + if username.upper().endswith(domain): + return username.split("@")[0] + tag return username fullnames = {}