[Commits] (vajda) - fixed bug 2536
commits at osafoundation.org
commits at osafoundation.org
Mon Feb 28 12:28:14 PST 2005
Commit by: vajda
Modified files:
chandler/repository/item/Item.py 1.198 1.199
chandler/repository/item/Monitors.py 1.8 1.9
chandler/repository/schema/Kind.py 1.103 1.104
chandler/repository/tests/TestMixins.py 1.5 1.6
chandler/repository/tests/classes/Movie.py 1.2 1.3
Log message:
- fixed bug 2536
- fixed bug 2517
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/repository/item/Item.py.diff?r1=text&tr1=1.198&r2=text&tr2=1.199
http://cvs.osafoundation.org/index.cgi/chandler/repository/item/Monitors.py.diff?r1=text&tr1=1.8&r2=text&tr2=1.9
http://cvs.osafoundation.org/index.cgi/chandler/repository/schema/Kind.py.diff?r1=text&tr1=1.103&r2=text&tr2=1.104
http://cvs.osafoundation.org/index.cgi/chandler/repository/tests/TestMixins.py.diff?r1=text&tr1=1.5&r2=text&tr2=1.6
http://cvs.osafoundation.org/index.cgi/chandler/repository/tests/classes/Movie.py.diff?r1=text&tr1=1.2&r2=text&tr2=1.3
Index: chandler/repository/tests/TestMixins.py
diff -u chandler/repository/tests/TestMixins.py:1.5 chandler/repository/tests/TestMixins.py:1.6
--- chandler/repository/tests/TestMixins.py:1.5 Wed Jan 5 12:17:49 2005
+++ chandler/repository/tests/TestMixins.py Mon Feb 28 12:28:12 2005
@@ -1,6 +1,6 @@
-__revision__ = "$Revision: 1.5 $"
-__date__ = "$Date: 2005/01/05 20:17:49 $"
+__revision__ = "$Revision: 1.6 $"
+__date__ = "$Date: 2005/02/28 20:28:12 $"
__copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -8,6 +8,7 @@
from repository.tests.RepositoryTestCase import RepositoryTestCase
from repository.item.Item import Item
+from repository.item.Monitors import Monitors
from repository.schema.Attribute import Attribute
from repository.schema.Kind import Kind
@@ -56,6 +57,21 @@
self.assert_(not isinstance(kh, Attribute))
self.assert_(mixin is actor)
+ def testMonitor(self):
+
+ kh = self.rep.findPath('//CineGuide/KHepburn')
+ m1 = kh.movies.first()
+ actor = kh.itsKind
+ movie = m1.itsKind
+ attribute = actor.getAttribute('movies').itsKind
+ self.assert_(kh.isItemOf(actor))
+
+ Monitors.attach(m1, 'kindChanged', 'kind', 'schema')
+ m1.monitorAttribute = None
+ mixin = kh.mixinKinds(('add', movie), ('add', attribute))
+
+ self.assert_(m1.monitorAttribute == 'schema')
+
if __name__ == "__main__":
# import hotshot
Index: chandler/repository/item/Monitors.py
diff -u chandler/repository/item/Monitors.py:1.8 chandler/repository/item/Monitors.py:1.9
--- chandler/repository/item/Monitors.py:1.8 Wed Feb 2 12:15:52 2005
+++ chandler/repository/item/Monitors.py Mon Feb 28 12:28:11 2005
@@ -1,6 +1,6 @@
-__revision__ = "$Revision: 1.8 $"
-__date__ = "$Date: 2005/02/02 20:15:52 $"
+__revision__ = "$Revision: 1.9 $"
+__date__ = "$Date: 2005/02/28 20:28:11 $"
__copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -43,7 +43,9 @@
monitor = [item, method, args, kwds]
try:
instance.monitoring[op][attribute].append(monitor)
- except KeyError:
+ except KeyError, e:
+ if e.args[0] == op:
+ instance.monitoring[op] = {}
instance.monitoring[op][attribute] = [monitor]
def detach(cls, item, method, op, attribute, *args, **kwds):
Index: chandler/repository/item/Item.py
diff -u chandler/repository/item/Item.py:1.198 chandler/repository/item/Item.py:1.199
--- chandler/repository/item/Item.py:1.198 Fri Feb 18 14:19:54 2005
+++ chandler/repository/item/Item.py Mon Feb 28 12:28:11 2005
@@ -1,6 +1,6 @@
-__revision__ = "$Revision: 1.198 $"
-__date__ = "$Date: 2005/02/18 22:19:54 $"
+__revision__ = "$Revision: 1.199 $"
+__date__ = "$Date: 2005/02/28 20:28:11 $"
__copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -1665,6 +1665,7 @@
removeOrphans(self._values)
removeOrphans(self._references)
+ prevKind = self._kind
self._kind = kind
if kind is None:
@@ -1674,6 +1675,8 @@
kind._setupClass(self.__class__)
kind.getInitialValues(self, self._values, self._references)
+ Item._monitorsClass.invoke('kind', self, 'schema')
+
def mixinKinds(self, *kinds):
"""
Mixin kinds into this item's kind.
Index: chandler/repository/schema/Kind.py
diff -u chandler/repository/schema/Kind.py:1.103 chandler/repository/schema/Kind.py:1.104
--- chandler/repository/schema/Kind.py:1.103 Wed Feb 16 12:41:04 2005
+++ chandler/repository/schema/Kind.py Mon Feb 28 12:28:11 2005
@@ -1,6 +1,6 @@
-__revision__ = "$Revision: 1.103 $"
-__date__ = "$Date: 2005/02/16 20:41:04 $"
+__revision__ = "$Revision: 1.104 $"
+__date__ = "$Date: 2005/02/28 20:28:11 $"
__copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -21,16 +21,15 @@
def __init__(self, name, parent, kind):
super(Kind, self).__init__(name, parent, kind)
-
- self.monitorSchema = False
self.__init()
def __init(self):
+ self.monitorSchema = False
+
# recursion avoidance
self._values['notFoundAttributes'] = []
- refList = self._refList('inheritedAttributes',
- 'inheritingKinds', False)
+ refList = self._refList('inheritedAttributes', 'inheritingKinds', False)
self._references['inheritedAttributes'] = refList
ofKind = self._refList('ofKind', 'kindOf', False)
Index: chandler/repository/tests/classes/Movie.py
diff -u chandler/repository/tests/classes/Movie.py:1.2 chandler/repository/tests/classes/Movie.py:1.3
--- chandler/repository/tests/classes/Movie.py:1.2 Wed Jul 28 13:40:39 2004
+++ chandler/repository/tests/classes/Movie.py Mon Feb 28 12:28:12 2005
@@ -16,3 +16,7 @@
def onItemCopy(self, original):
print 'copied', self.title, 'from', original.itsUUID
+
+ def kindChanged(self, op, item, attribute):
+
+ self.monitorAttribute = attribute
More information about the Commits
mailing list