[cig-commits] commit: Work around a bug with UserInfo not having an id, but rather a user_id

Mercurial hg at geodynamics.org
Sun Jul 3 20:05:08 PDT 2011


changeset:   29:240a9bc9566b
user:        Walter Landry <wlandry at caltech.edu>
date:        Sat Jul 02 20:23:06 2011 -0700
files:       SeismoWebPortal/models.py
description:
Work around a bug with UserInfo not having an id, but rather a user_id


diff -r 8d8858ca8df2 -r 240a9bc9566b SeismoWebPortal/models.py
--- a/SeismoWebPortal/models.py	Sat Jul 02 20:19:14 2011 -0700
+++ b/SeismoWebPortal/models.py	Sat Jul 02 20:23:06 2011 -0700
@@ -36,7 +36,11 @@ class Model(models.Model):
         if hasattr(self, 'isArchival') and self.isArchival():
             # Don't delete archived objects.
             del seen_objs[self.__class__][self._get_pk_val()]
-        for obj in Ownership.objects.filter(objType = self.contentType(), objId = self.id):
+        if hasattr(self, 'id'):
+            selfid=self.id
+        else:
+            selfid=self.user_id
+        for obj in Ownership.objects.filter(objType = self.contentType(), objId = selfid):
             obj._collect_sub_objects(seen_objs)
         return
 



More information about the CIG-COMMITS mailing list