[Commits] (donn) Fixed a problem setting a RefDict attribute to
itself.
commits at osafoundation.org
commits at osafoundation.org
Tue Aug 3 02:17:06 PDT 2004
Commit by: donn
Modified files:
chandler/repository/item/Item.py 1.147 1.148
chandler/repository/tests/TestReferenceAttributes.py 1.18 1.19
Log message:
Fixed a problem setting a RefDict attribute to itself.
* added a test case to TestReferenceAttributes
ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/repository/item/Item.py.diff?r1=text&tr1=1.147&r2=text&tr2=1.148
http://cvs.osafoundation.org/index.cgi/chandler/repository/tests/TestReferenceAttributes.py.diff?r1=text&tr1=1.18&r2=text&tr2=1.19
Index: chandler/repository/item/Item.py
diff -u chandler/repository/item/Item.py:1.147 chandler/repository/item/Item.py:1.148
--- chandler/repository/item/Item.py:1.147 Sun Aug 1 04:14:40 2004
+++ chandler/repository/item/Item.py Tue Aug 3 02:17:04 2004
@@ -1,6 +1,6 @@
-__revision__ = "$Revision: 1.147 $"
-__date__ = "$Date: 2004/08/01 11:14:40 $"
+__revision__ = "$Revision: 1.148 $"
+__date__ = "$Date: 2004/08/03 09:17:04 $"
__copyright__ = "Copyright (c) 2002 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -377,6 +377,8 @@
self._kind.getOtherName(name))
elif isinstance(old, RefDict):
+ if old is value:
+ return value
old.clear()
else:
Index: chandler/repository/tests/TestReferenceAttributes.py
diff -u chandler/repository/tests/TestReferenceAttributes.py:1.18 chandler/repository/tests/TestReferenceAttributes.py:1.19
--- chandler/repository/tests/TestReferenceAttributes.py:1.18 Thu Jul 29 07:07:14 2004
+++ chandler/repository/tests/TestReferenceAttributes.py Tue Aug 3 02:17:05 2004
@@ -2,8 +2,8 @@
Unit tests for reference attributes
"""
-__revision__ = "$Revision: 1.18 $"
-__date__ = "$Date: 2004/07/29 14:07:14 $"
+__revision__ = "$Revision: 1.19 $"
+__date__ = "$Date: 2004/08/03 09:17:05 $"
__copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
__license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
@@ -223,6 +223,11 @@
(manager, [emp1, emp2, emp3, emp4]) = self._findManagerAndEmployees('//bossA','//employeeA1','//employeeA2','//employeeA3','//employeeA4')
self._checkManagerAndEmployees(manager, [ emp1, emp2, emp3, emp4 ])
+ # now test reassigning the same refdictionary
+ numEmployees = len(manager.employees)
+ manager.employees = manager.employees
+ self.assert_(len(manager.employees) == numEmployees)
+
def testSubAttributes(self):
"""Test attributes which have sub attributes (subAttributes and superAttribute attributes)"""
itemKind = self._find('//Schema/Core/Item')
More information about the Commits
mailing list