[Checkins] SVN: z3c.relationfield/trunk/ Fix another getUtility call. This completes the fix from r99135.

Wichert Akkerman wichert at wiggy.net
Wed Apr 22 08:51:14 EDT 2009


Log message for revision 99363:
  Fix another getUtility call. This completes the fix from r99135.

Changed:
  U   z3c.relationfield/trunk/CHANGES.txt
  U   z3c.relationfield/trunk/src/z3c/relationfield/event.py

-=-
Modified: z3c.relationfield/trunk/CHANGES.txt
===================================================================
--- z3c.relationfield/trunk/CHANGES.txt	2009-04-22 08:18:12 UTC (rev 99362)
+++ z3c.relationfield/trunk/CHANGES.txt	2009-04-22 12:51:14 UTC (rev 99363)
@@ -4,8 +4,10 @@
 0.5 (unreleased)
 ================
 
-* ...
+* Prevent the event failures from failing when utilities are missing or when
+  objects do not implement IContained.
 
+
 0.4.1 (2009-02-12)
 ==================
 

Modified: z3c.relationfield/trunk/src/z3c/relationfield/event.py
===================================================================
--- z3c.relationfield/trunk/src/z3c/relationfield/event.py	2009-04-22 08:18:12 UTC (rev 99362)
+++ z3c.relationfield/trunk/src/z3c/relationfield/event.py	2009-04-22 12:51:14 UTC (rev 99363)
@@ -49,9 +49,12 @@
 def updateRelations(obj, event):
     """Re-register relations, after they have been changed.
     """
-    catalog = component.getUtility(ICatalog)
-    intids = component.getUtility(IIntIds)
+    catalog = component.queryUtility(ICatalog)
+    intids = component.queryUtility(IIntIds)
 
+    if catalog is None or intids is None:
+        return
+
     # check that the object has an intid, otherwise there's nothing to be done
     try:
         obj_id = intids.getId(obj)



More information about the Checkins mailing list