[Dev] Small tweak to parcel loader
Andi Vajda
vajda at osafoundation.org
Tue Jun 15 10:53:10 PDT 2004
> However, if I create three items, parent, child1 and child2, and do:
>
> child1.parentBlock = parent
> child2.parentBlock = parent
> for child in parent.childrenBlocks:
> print child, child.parentBlock
>
> ...I get an exception:
>
> Traceback (most recent call last):
> File "TestCollections.py", line 35, in testCollections
> for child in parent.childrenBlocks:
> File "/Users/morgen/dev/chandler/repository/util/LinkedMap.py", line
> 238, in __iter__
> yield self[key]
> File "/Users/morgen/dev/chandler/repository/item/ItemRef.py", line
> 528, in __getitem__
> return self._getRef(key).other(self._getItem())
> File "/Users/morgen/dev/chandler/repository/item/ItemRef.py", line
> 126, in other
> raise ValueError, "%s doesn't reference %s" %(self, item)
> ValueError: <ItemRef: <Item: child1
> 49783b2a-bc10-11d8-a380-000a95bb2738> - <Item: parent
> 4976fb48-bc10-11d8-a380-000a95bb2738>> doesn't reference <Kind: Block
> 4970bd8c-bc10-11d8-a380-000a95bb2738>
>
> I suspect that this has something to do with the way the parcel loader
> is calling the repo API to set the initialValue of the childrenBlocks
> attribute to an empty list:
>
> attributeItem.addValue("initialValue", [ ] )
>
> Perhaps Andi can set me straight as to the proper way to use the API to
> specify an initialValue of empty list (or dict).
Yes, there was a bug here. I just checked in the fix for it. Oops.
Andi..
More information about the Dev
mailing list