[Zope] uncataloging
Dieter Maurer
dieter at handshake.de
Sun Aug 17 03:00:27 EDT 2008
Jens Vagelpohl wrote at 2008-8-16 11:45 +0200:
>
>On Aug 16, 2008, at 11:06 , Dieter Maurer wrote:
>
>> The easiest way to determine the "uid" is probably
>> to locate the object via a catalog search. You will get a catalog
>> proxy
>> for the object, often also called "brain".
>> This proxy has the method "getPath()"
>> which returns the object's "uid" -- don't ask about the inconsistent
>> naming (at one place "uid", at another one "path").
>
>The naming is not inconsistent. The UID happens to be the path by
>default, but it doesn't need to be. The getPath method returns the
>path, not the UID.
You err with the last sentence (which indicates that consistent
naming *is* important):
"CatalogBrain.getPath" is mapped to "ZCatalog.getpath"
which is mapped to "Catalog.paths".
And the comment in "Catalog" says
# self.uids is a mapping of the
# object unique identifier to the rid, and self.paths is a
# mapping of the rid to the unique identifier
The code confirms this comment:
self.uids[uid] = index
self.paths[index] = uid
Thus, "getPath" *DOES* return the uid and not the path.
--
Dieter
More information about the Zope
mailing list