[Chandler-dev] changed single-ref handling
Andi Vajda
vajda at osafoundation.org
Fri Jun 9 19:36:02 PDT 2006
While working on bug 6028 [1], I realized I had made the wrong choice a long
time ago in how to handle single-refs that point at no existing items.
A single-ref is the value that gets substituted for an item when it is put
into an attribute not setup to handle bi-refs. This is usually the case when
using python collections like 'list', 'dict' or 'set' type values.
By default, when a single-ref value is found, the item it references is
returned. But when the item no longer exists, it is 'None' that was returned
until now.
The problem with returning 'None' is that it then becomes rather difficult to
work with the attribute since it's hard to know what single-ref caused None to
be returned. In bug 6028 for example, a single-ref for a deleted item was
being removed from a 'set' value but 'None' was passed to the remove() method
and that didn't work too well.
I changed the data model code to now return the dangling single-ref instead of
None. When the single-ref refers to an existing item, this item is returned as
before.
Andi..
[1] http://bugzilla.osafoundation.org/show_bug.cgi?id=6028
More information about the chandler-dev
mailing list