Fix sending to cross-realm Zephyr users.

(imported from commit 1eebf286e149aa1242d6d26096003eb696fb18f2)
This commit is contained in:
Tim Abbott 2012-11-09 15:25:54 -05:00
parent c0e29b6a54
commit 35fbf350ae

View file

@ -25,7 +25,7 @@ def to_zephyr_username(humbug_username):
(user, realm) = humbug_username.split("@") (user, realm) = humbug_username.split("@")
if "|" not in user: if "|" not in user:
return user.lower() + "@ATHENA.MIT.EDU" return user.lower() + "@ATHENA.MIT.EDU"
match_user = re.match(r'([a-zA-Z0-9_]+)\|(.+)@mit\.edu', user) match_user = re.match(r'([a-zA-Z0-9_]+)\|(.+)', user)
if not match_user: if not match_user:
raise Exception("Could not parse Zephyr realm for cross-realm user %s" % (humbug_username,)) raise Exception("Could not parse Zephyr realm for cross-realm user %s" % (humbug_username,))
return match_user.group(1).lower() + "@" + match_user.group(2).upper() return match_user.group(1).lower() + "@" + match_user.group(2).upper()