You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/04/15 13:23:06 UTC
allura git commit: [#7856] ticket:753 Handle emails in unexpected
formats
Repository: allura
Updated Branches:
refs/heads/ib/7856 [created] e6c653620
[#7856] ticket:753 Handle emails in unexpected formats
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/e6c65362
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/e6c65362
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/e6c65362
Branch: refs/heads/ib/7856
Commit: e6c653620ce5d17bfaeda9b575d3acef14a9d7b0
Parents: 747cad0
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Thu Apr 9 20:39:23 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Wed Apr 15 11:11:56 2015 +0000
----------------------------------------------------------------------
Allura/allura/model/auth.py | 7 +++++--
Allura/allura/tests/model/test_auth.py | 2 ++
2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/e6c65362/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 98dc4ec..8b06c73 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -169,8 +169,11 @@ class EmailAddress(MappedClass):
if mo:
addr = mo.group(1)
if '@' in addr:
- user, domain = addr.strip().split('@')
- return '%s@%s' % (user, domain.lower())
+ try:
+ user, domain = addr.strip().split('@')
+ return '%s@%s' % (user, domain.lower())
+ except ValueError:
+ return addr.strip()
else:
return None
http://git-wip-us.apache.org/repos/asf/allura/blob/e6c65362/Allura/allura/tests/model/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_auth.py b/Allura/allura/tests/model/test_auth.py
index eb7416c..4281bb1 100644
--- a/Allura/allura/tests/model/test_auth.py
+++ b/Allura/allura/tests/model/test_auth.py
@@ -105,6 +105,8 @@ def test_email_address_canonical():
'nobody@example.com')
assert_equal(M.EmailAddress.canonical(' nobody@example.com\t'),
'nobody@example.com')
+ assert_equal(M.EmailAddress.canonical('I Am@Nobody <no...@example.com> '),
+ 'I Am@Nobody <no...@example.com>')
assert_equal(M.EmailAddress.canonical('invalid'), None)
@with_setup(setUp)