[Commits] (john) * fixed #2701

commits at osafoundation.org commits at osafoundation.org
Tue Mar 22 14:08:32 PST 2005


Commit by: john
Modified files:
chandler/parcels/osaf/contentmodel/ItemCollection.py 1.40 1.40.2.1
chandler/repository/query/Query.py 1.38 1.38.2.1

Log message:
* fixed #2701

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

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

Index: chandler/repository/query/Query.py
diff -u chandler/repository/query/Query.py:1.38 chandler/repository/query/Query.py:1.38.2.1
--- chandler/repository/query/Query.py:1.38	Tue Mar 15 09:20:14 2005
+++ chandler/repository/query/Query.py	Tue Mar 22 14:08:30 2005
@@ -1,6 +1,6 @@
 
-__revision__  = "$Revision: 1.38 $"
-__date__      = "$Date: 2005/03/15 17:20:14 $"
+__revision__  = "$Revision: 1.38.2.1 $"
+__date__      = "$Date: 2005/03/22 22:08:30 $"
 __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):
     """

Index: chandler/parcels/osaf/contentmodel/ItemCollection.py
diff -u chandler/parcels/osaf/contentmodel/ItemCollection.py:1.40 chandler/parcels/osaf/contentmodel/ItemCollection.py:1.40.2.1
--- chandler/parcels/osaf/contentmodel/ItemCollection.py:1.40	Sun Mar 13 18:54:12 2005
+++ chandler/parcels/osaf/contentmodel/ItemCollection.py	Tue Mar 22 14:08:30 2005
@@ -1,4 +1,4 @@
-__date__ = "$Date: 2005/03/14 02:54:12 $"
+__date__ = "$Date: 2005/03/22 22:08:30 $"
 __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)



More information about the Commits mailing list