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/21 16:25:55 UTC

[25/25] allura git commit: [#7856] ticket:757 Fix email regex

[#7856] ticket:757 Fix email regex


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/c27af24d
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/c27af24d
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/c27af24d

Branch: refs/heads/ib/7856
Commit: c27af24dafa4582b83af44314dc0ce8d736e4b57
Parents: 8ea45a5
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Apr 21 09:25:13 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Tue Apr 21 09:25:13 2015 +0000

----------------------------------------------------------------------
 Allura/allura/model/auth.py            | 2 +-
 Allura/allura/tests/model/test_auth.py | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/c27af24d/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 8b06c73..bc16649 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -109,7 +109,7 @@ class AlluraUserProperty(ForeignIdProperty):
 
 
 class EmailAddress(MappedClass):
-    re_format = re.compile('^.* <(.*)>$')
+    re_format = re.compile('^.*\s+<(.*)>\s*$')
 
     class __mongometa__:
         name = 'email_address'

http://git-wip-us.apache.org/repos/asf/allura/blob/c27af24d/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 4281bb1..5d1841b 100644
--- a/Allura/allura/tests/model/test_auth.py
+++ b/Allura/allura/tests/model/test_auth.py
@@ -106,7 +106,11 @@ def test_email_address_canonical():
     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>')
+                 'nobody@example.com')
+    assert_equal(M.EmailAddress.canonical(' No@body <no...@example.com> '),
+                 'no@body@example.com')
+    assert_equal(M.EmailAddress.canonical('no@body@example.com'),
+                 'no@body@example.com')
     assert_equal(M.EmailAddress.canonical('invalid'), None)
 
 @with_setup(setUp)