Commit by: john
Modified files:
chandler/repository/query/Query.py 1.39 1.40
chandler/parcels/osaf/contentmodel/ItemCollection.py 1.41 1.42

Log message:
* fixed #2701

Bugzilla links:
http://bugzilla.osafoundation.org/show_bug.cgi?id=2701

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/repository/query/Query.py.diff?r1=text&tr1=1.39&r2=text&tr2=1.40
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/contentmodel/ItemCollection.py.diff?r1=text&tr1=1.41&r2=text&tr2=1.42

Index: chandler/parcels/osaf/contentmodel/ItemCollection.py
diff -u chandler/parcels/osaf/contentmodel/ItemCollection.py:1.41 
chandler/parcels/osaf/contentmodel/ItemCollection.py:1.42
--- chandler/parcels/osaf/contentmodel/ItemCollection.py:1.41   Fri Mar 18 
13:41:41 2005
+++ chandler/parcels/osaf/contentmodel/ItemCollection.py        Tue Mar 22 
14:16:20 2005
@@ -1,4 +1,4 @@
-__date__ = "$Date: 2005/03/18 21:41:41 $"
+__date__ = "$Date: 2005/03/22 22:16:20 $"
 __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm";
 
@@ -128,4 +128,12 @@
             self.createIndex()
             return self.resultSet.getIndexPosition (self.indexName, item)
 
-
+    def subscribe(self, *arguments, **keywords):
+        if self.source:
+            self.source.subscribe (self, "")
+        super (ItemCollection, self).subscribe (*arguments, **keywords)
+
+    def unsubscribe(self, *arguments, **keywords):
+        super (ItemCollection, self).unsubscribe (*arguments, **keywords)
+        if self.source:
+            self.source.unsubscribe (self)

Index: chandler/repository/query/Query.py
diff -u chandler/repository/query/Query.py:1.39 
chandler/repository/query/Query.py:1.40
--- chandler/repository/query/Query.py:1.39     Fri Mar 18 13:41:49 2005
+++ chandler/repository/query/Query.py  Tue Mar 22 14:16:19 2005
@@ -1,6 +1,6 @@
 
-__revision__  = "$Revision: 1.39 $"
-__date__      = "$Date: 2005/03/18 21:41:49 $"
+__revision__  = "$Revision: 1.40 $"
+__date__      = "$Date: 2005/03/22 22:16:19 $"
 __copyright__ = "Copyright (c) 2004, 2005 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm";
 
@@ -238,8 +238,14 @@
             log.debug(u"RepoQuery.queryCallback: %s %s query result" % (uuid, 
[added, removed, changed_uuids] ))
             for callbackUUID in self._otherViewSubscribeCallbacks:
                 item = view.find (callbackUUID)
-                method = getattr (type(item), 
self._otherViewSubscribeCallbacks [callbackUUID])
-                method (item, (added,removed))
+                """
+                  We allow subscriptions to items without callbacks. This used 
to keep the _resultSet up to date
+                when notifications aren't required -- DJA
+                """
+                methodName = self._otherViewSubscribeCallbacks [callbackUUID]
+                if methodName:
+                    method = getattr (type(item), methodName)
+                    method (item, (added,removed))
         log.debug(u"queryCallback: %s:%f" % (self.queryString, 
time.time()-start))
 
     def __len__ (self):
@@ -336,8 +342,14 @@
             
             for callbackUUID in self._sameViewSubscribeCallbacks:
                 i = self.itsView.find(callbackUUID)
-                method = getattr(type(i), 
self._sameViewSubscribeCallbacks[callbackUUID])
-                method(i, action)
+                """
+                  We allow subscriptions to items without callbacks. This used 
to keep the _resultSet up to date
+                when notifications aren't required -- DJA
+                """
+                methodName = self._sameViewSubscribeCallbacks[callbackUUID]
+                if methodName:
+                    method = getattr(type(i), methodName)
+                    method(i, action)
 
 class LogicalPlan(object):
     """

_______________________________________________
Commits mailing list
Commits@osafoundation.org
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to