[Dev] Item API renames

Andi Vajda vajda at osafoundation.org
Tue Mar 23 21:20:02 PST 2004

During the recent Data Model meeting it was decided that the following Item
APIs needed to be replaced by python properties:

  - getItemName()    ->    itsName    (read/write)
  - getUUID()        ->    itsUUID    (read-only)
  - getItemPath()    ->    itsPath    (read-only)
  - getItemParent()  ->    itsParent  (read/write)
  - getRoot()        ->    itsRoot    (read-only)

In addition, the 'kind' transient attribute was removed and also replaced by a
python property:

  - kind            ->     itsKind    (read-only)

These properties, all prefixed with 'its', represent the intrinsic properties
of an item.

For example, code that looked like:
   - item.getItemParent().kind.getItemName()
Now is:
   - item.itsParent.itsKind.itsName

The kind<->items bi-directional ref attribute pair caused confusion as it was
transient and therefore contained only the loaded items of a given kind.

To get the kind of an item now use:
   - item.itsKind

To get all the items of a kind, use a KindQuery:
   - KindQuery(recursive=False).run([kind])

I believe I found all the places in Chandler source code that referred to the
old API and replaced them all with the new ones. Chandler runs and all unit
tests pass.

If I missed something, let me know.


ps: John, RepositoryView (the parent of repository roots) now also has
    itsName, itsPath, itsParent and itsUUID properties.

More information about the Dev mailing list