Re: [Zope] uncataloging

2008-08-17 Thread Dieter Maurer
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
___
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 )


Re: [Zope] uncataloging

2008-08-16 Thread Dieter Maurer
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
___
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 )


Re: [Zope] uncataloging

2008-08-16 Thread Jens Vagelpohl

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


___
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 )


Re: [Zope] uncataloging

2008-08-14 Thread Peter Bengtsson
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 [EMAIL PROTECTED]:
 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
___
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 )


Re: [Zope] uncataloging

2008-08-14 Thread Tres Seaver
-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/CatalogAwareness.py?rev=82440view=auto

The CMF version lets the catalog figure it out:

http://svn.zope.org/Products.CMFCore/branches/2.1/Products/CMFCore/CMFCatalogAware.py?rev=82471view=auto
http://svn.zope.org/Products.CMFCore/branches/2.1/Products/CMFCore/CatalogTool.py?rev=81780view=auto


Tres.
- --
===
Tres Seaver  +1 540-429-0999  [EMAIL PROTECTED]
Palladion Software   Excellence by Designhttp://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-

___
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 )