Hey folks, I have looked at the source of Catalog.py but am still confused about what parameters I need to uncatalog an object. Is the uid the same as the object id? That which is returned from obj.getId(), or is it the same as the object Identifier listed on the Catalog tab within the catalog? Thanks in advance. Code samples welcome. -d
I don't know how to uncatalog a brain but I do know how to uncatalog a normal zope object:: # to uncatalog 'self' path = '/'.join(self.getPhysicalPath()) self.MyCatalog.uncatalog_object(path) # to uncatalog some other know object path = '/'.join(self.some_object.getPhysicalPath()) self.MyCatalog.uncatalog_object(path) 2008/8/14 Darryl Caldwell <darryl.caldwell@gmail.com>:
Hey folks,
I have looked at the source of Catalog.py but am still confused about what parameters I need to uncatalog an object.
Is the uid the same as the object id? That which is returned from obj.getId(), or is it the same as the object Identifier listed on the Catalog tab within the catalog? Thanks in advance. Code samples welcome.
-d _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Darryl Caldwell wrote:
Hey folks,
I have looked at the source of Catalog.py but am still confused about what parameters I need to uncatalog an object.
Is the uid the same as the object id? That which is returned from obj.getId(), or is it the same as the object Identifier listed on the Catalog tab within the catalog? Thanks in advance. Code samples welcome.
The UID is an application-specific token for the indexed object. It is what gets displayed on the 'Catalog' tab. Often, it will be the physical path, or a subset of it (e.g., trimmed to be relative to the current "site"). Have a look at the CatalogAware class for how the uid is generated. The Zope2 version uses a a goofy version of a virtual hosting-aware URL: http://svn.zope.org/Zope/branches/2.11/lib/python/Products/ZCatalog/CatalogA... The CMF version lets the catalog figure it out: http://svn.zope.org/Products.CMFCore/branches/2.1/Products/CMFCore/CMFCatalo... http://svn.zope.org/Products.CMFCore/branches/2.1/Products/CMFCore/CatalogTo... Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIpEEE+gerLs4ltQ4RAptmAJ9gMEy0B0Mk2obH6EX0mIQTSgrZ6QCfbZDJ 1Px/GvmOGT+Np91a2Zop6Tg= =3th6 -----END PGP SIGNATURE-----
Darryl Caldwell wrote at 2008-8-13 19:49 -0800:
... I have looked at the source of Catalog.py but am still confused about what parameters I need to uncatalog an object.
Is the uid the same as the object id?
No. The "uid" that you must pass to "uncatalog_object" is the same one that has been passed to "catalog_object".
That which is returned from obj.getId()
No.
or is it the same as the object Identifier listed on the Catalog tab within the catalog?
Yes. 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"). -- Dieter
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. jens
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
participants (5)
-
Darryl Caldwell -
Dieter Maurer -
Jens Vagelpohl -
Peter Bengtsson -
Tres Seaver