allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject git commit: [#7692] clean up claim_address logic
Date Thu, 18 Sep 2014 22:44:55 GMT
Repository: allura
Updated Branches:
  refs/heads/db/7692 [created] 3edcba7f0


[#7692] clean up claim_address logic

* put the `if` statement around the email_address.append call itself, rather than having
2 return paths which cause inconsistency with the flush call
* return the email_addr record for convenience


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

Branch: refs/heads/db/7692
Commit: 3edcba7f0ca87fe283e906d1111bd7380b21079b
Parents: 3e6a76c
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Thu Sep 18 22:18:47 2014 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Thu Sep 18 22:18:47 2014 +0000

----------------------------------------------------------------------
 Allura/allura/model/auth.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/3edcba7f/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index b7ea34b..827c6fc 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -577,10 +577,10 @@ class User(MappedClass, ActivityNode, ActivityObject):
         addr = EmailAddress.canonical(email_address)
         email_addr = EmailAddress.create(addr)
         email_addr.claimed_by_user_id = self._id
-        if addr in self.email_addresses:
-            return
-        self.email_addresses.append(addr)
+        if addr not in self.email_addresses:
+            self.email_addresses.append(addr)
         session(email_addr).flush(email_addr)
+        return email_addr
 
     @classmethod
     def register(cls, doc, make_project=True):


Mime
View raw message