Commit by: vajda Modified files: chandler/repository/item/RefCollections.py 1.10 1.11 chandler/repository/item/Values.py 1.39 1.40 chandler/repository/schema/Cloud.py 1.21 1.22 chandler/repository/util/LinkedMap.py 1.23 1.24
Log message: fixed bi-ref bug (t62) ViewCVS links: http://cvs.osafoundation.org/index.cgi/chandler/repository/item/RefCollections.py.diff?r1=text&tr1=1.10&r2=text&tr2=1.11 http://cvs.osafoundation.org/index.cgi/chandler/repository/item/Values.py.diff?r1=text&tr1=1.39&r2=text&tr2=1.40 http://cvs.osafoundation.org/index.cgi/chandler/repository/schema/Cloud.py.diff?r1=text&tr1=1.21&r2=text&tr2=1.22 http://cvs.osafoundation.org/index.cgi/chandler/repository/util/LinkedMap.py.diff?r1=text&tr1=1.23&r2=text&tr2=1.24 Index: chandler/repository/item/RefCollections.py diff -u chandler/repository/item/RefCollections.py:1.10 chandler/repository/item/RefCollections.py:1.11 --- chandler/repository/item/RefCollections.py:1.10 Tue Jan 11 11:48:50 2005 +++ chandler/repository/item/RefCollections.py Fri Jan 21 11:16:06 2005 @@ -1,6 +1,6 @@ -__revision__ = "$Revision: 1.10 $" -__date__ = "$Date: 2005/01/11 19:48:50 $" +__revision__ = "$Revision: 1.11 $" +__date__ = "$Date: 2005/01/21 19:16:06 $" __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation" __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm" @@ -883,6 +883,10 @@ logger.error("Iterator on %s caused DanglingRefError: %s", self, str(e)) return False + except BadRefError, e: + logger.error("Iterator on %s caused BadRefError: %s", + self, str(e)) + return False l -= 1 prevKey = key key = self.nextKey(key) Index: chandler/repository/item/Values.py diff -u chandler/repository/item/Values.py:1.39 chandler/repository/item/Values.py:1.40 --- chandler/repository/item/Values.py:1.39 Wed Jan 19 13:46:00 2005 +++ chandler/repository/item/Values.py Fri Jan 21 11:16:06 2005 @@ -1,6 +1,6 @@ -__revision__ = "$Revision: 1.39 $" -__date__ = "$Date: 2005/01/19 21:46:00 $" +__revision__ = "$Revision: 1.40 $" +__date__ = "$Date: 2005/01/21 19:16:06 $" __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation" __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm" @@ -374,6 +374,11 @@ if value is not None and value._isItem(): value._references._removeRef(otherName, self._item) + if other is not None and otherName in other._references: + value = other._references._getRef(otherName) + if value is not None and value._isItem(): + value._references._removeRef(name, other) + self._setRef(name, other, otherName, **kwds) if other is not None: other._references._setRef(otherName, self._item, name, @@ -414,7 +419,7 @@ if other is None: if value is self: - raise KeyError + raise KeyError, name if value is None: return value if value._isUUID(): @@ -556,11 +561,10 @@ item = self._item for name, value in orig.iteritems(): policy = copyPolicy or item.getAttributeAspect(name, 'copyPolicy') - if value is not None: - if value._isRefList(): - value._copy(item, name, policy, copyFn) - else: - orig._copyRef(item, name, value, policy, copyFn) + if value is not None and value._isRefList(): + value._copy(item, name, policy, copyFn) + else: + orig._copyRef(item, name, value, policy, copyFn) def _unload(self): @@ -775,8 +779,14 @@ otherOther = other._references._getRef(otherName) if not (otherOther is self._item or otherOther._isRefList() and self._item in otherOther): - logger.error("%s.%s doesn't reference %s.%s", - other.itsPath, otherName, self._item.itsPath, name) + if otherOther._isRefList(): + logger.error("%s doesn't contain a reference to %s, yet %s.%s references %s", + otherOther, other._repr_(), other._repr_(), + otherName, self._item._repr_()) + else: + logger.error("%s.%s doesn't reference %s.%s but %s", + other._repr_(), otherName, self._item._repr_(), + name, otherOther) return False return True Index: chandler/repository/schema/Cloud.py diff -u chandler/repository/schema/Cloud.py:1.21 chandler/repository/schema/Cloud.py:1.22 --- chandler/repository/schema/Cloud.py:1.21 Tue Jan 11 11:48:50 2005 +++ chandler/repository/schema/Cloud.py Fri Jan 21 11:16:07 2005 @@ -1,6 +1,6 @@ -__revision__ = "$Revision: 1.21 $" -__date__ = "$Date: 2005/01/11 19:48:50 $" +__revision__ = "$Revision: 1.22 $" +__date__ = "$Date: 2005/01/21 19:16:07 $" __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation" __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm" @@ -140,18 +140,16 @@ if other is None: return None uuid = other._uuid + if uuid in copies: + return copies[uuid] if uuid in items: - if uuid in copies: - return copies[uuid] - else: - other = other.copy(None, parent, copies, 'remove', - None, copyOther) - results.append(other) - return other - elif uuid in references: + other = other.copy(None, parent, copies, 'remove', + None, copyOther) + results.append(other) return other - else: - return Item.Nil + if uuid in references: + return other + return Item.Nil copy = item.copy(name, parent, copies, 'remove', None, copyOther) results.insert(0, copy) Index: chandler/repository/util/LinkedMap.py diff -u chandler/repository/util/LinkedMap.py:1.23 chandler/repository/util/LinkedMap.py:1.24 --- chandler/repository/util/LinkedMap.py:1.23 Tue Dec 21 15:39:56 2004 +++ chandler/repository/util/LinkedMap.py Fri Jan 21 11:16:07 2005 @@ -1,6 +1,6 @@ -__revision__ = "$Revision: 1.23 $" -__date__ = "$Date: 2004/12/21 23:39:56 $" +__revision__ = "$Revision: 1.24 $" +__date__ = "$Date: 2005/01/21 19:16:07 $" __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation" __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm" @@ -159,13 +159,13 @@ if previousKey is not None and previousKey != key: self._get(previousKey)._setNext(key, previousKey, self) + super(LinkedMap, self).__setitem__(key, link) + if previousKey is None or previousKey != key: link._setPrevious(previousKey, key, self) if nextKey is None or nextKey != key: link._setNext(nextKey, key, self) - super(LinkedMap, self).__setitem__(key, link) - if alias: link._alias = alias if self._aliases is None: _______________________________________________ Commits mailing list Commits@osafoundation.org http://lists.osafoundation.org/mailman/listinfo/commits