You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/04/21 19:43:22 UTC

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

Repository: allura
Updated Branches:
  refs/heads/master d162d676d -> cf4d52815


[#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/cf4d5281
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/cf4d5281
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/cf4d5281

Branch: refs/heads/master
Commit: cf4d52815cb2cad21de328e00b738b8ee1b55fd5
Parents: 1acc5f3
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Apr 21 09:25:13 2015 +0000
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Tue Apr 21 13:40:49 2015 -0400

----------------------------------------------------------------------
 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/cf4d5281/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/cf4d5281/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)


[2/2] allura git commit: [#7856] ticket:753 Handle emails in unexpected formats

Posted by he...@apache.org.
[#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/1acc5f38
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/1acc5f38
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/1acc5f38

Branch: refs/heads/master
Commit: 1acc5f38f47d38683016d8f569bbd047765b2c8b
Parents: d162d67
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Thu Apr 9 20:39:23 2015 +0300
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Tue Apr 21 13:40:49 2015 -0400

----------------------------------------------------------------------
 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/1acc5f38/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/1acc5f38/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)