app/soc/logic/models/base.py
changeset 1516 8df06dc877aa
parent 1515 75de65fcb017
child 1517 a467d13e34ea
--- a/app/soc/logic/models/base.py	Thu Feb 26 16:50:59 2009 +0000
+++ b/app/soc/logic/models/base.py	Thu Feb 26 16:51:35 2009 +0000
@@ -384,12 +384,10 @@
     if create_entity:
       # entity did not exist, so create one in a transaction
       entity = self._model.get_or_insert(key_name, **properties)
-
-
-    # there is no way to be sure if get_or_insert() returned a new entity or
-    # got an existing one due to a race, so update with properties anyway,
-    # in a transaction
-    entity = self.updateEntityProperties(entity, properties, silent=True)
+    else:
+      # If someone else already created the entity (due to a race), we
+      # should not update the propties (as they 'won' the race).
+      entity = self.updateEntityProperties(entity, properties, silent=True)
 
     if create_entity:
       # a new entity has been created call _onCreate