allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject allura git commit: [#7819] handle email lookups of None
Date Wed, 21 Jan 2015 20:46:19 GMT
Repository: allura
Updated Branches:
  refs/heads/db/7819 [created] 5f96cdfb6


[#7819] handle email lookups of None


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

Branch: refs/heads/db/7819
Commit: 5f96cdfb6b30fb1c5945eaf4820f511e9e2ab8c1
Parents: 83a7584
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Wed Jan 21 20:46:11 2015 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed Jan 21 20:46:11 2015 +0000

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


http://git-wip-us.apache.org/repos/asf/allura/blob/5f96cdfb/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 855bb6b..e8bd8a6 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -127,7 +127,7 @@ class EmailAddress(MappedClass):
     def get(cls, **kw):
         '''Equivalent to Ming's query.get but calls self.canonical on address
         before lookup. You should always use this instead of query.get'''
-        if 'email' in kw:
+        if kw.get('email'):
             kw['email'] = cls.canonical(kw['email'])
         return cls.query.get(**kw)
 
@@ -136,7 +136,7 @@ class EmailAddress(MappedClass):
         '''Equivalent to Ming's query.find but calls self.canonical on address
         before lookup. You should always use this instead of query.find'''
         if q:
-            if 'email' in q:
+            if q.get('email'):
                 q['email'] = cls.canonical(q['email'])
             return cls.query.find(q)
         return cls.query.find()

http://git-wip-us.apache.org/repos/asf/allura/blob/5f96cdfb/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 75ba74c..3356ce1 100644
--- a/Allura/allura/tests/model/test_auth.py
+++ b/Allura/allura/tests/model/test_auth.py
@@ -80,10 +80,12 @@ def test_email_address_lookup_helpers():
     assert_equal(M.EmailAddress.get(email='TEST@DOMAIN.NET'), addr)
     assert_equal(M.EmailAddress.get(email='TEST@domain.net'), addr)
     assert_equal(M.EmailAddress.get(email='test@domain.net'), None)
+    assert_equal(M.EmailAddress.get(email=None), None)
 
     assert_equal(M.EmailAddress.find(dict(email='TEST@DOMAIN.NET')).all(), [addr])
     assert_equal(M.EmailAddress.find(dict(email='TEST@domain.net')).all(), [addr])
     assert_equal(M.EmailAddress.find(dict(email='test@domain.net')).all(), [])
+    assert_equal(M.EmailAddress.find(dict(email=None)).all(), [])
 
 
 @with_setup(setUp)


Mime
View raw message