[Zope] ZCatalog searching

Dieter Maurer dieter@handshake.de
Wed, 8 Aug 2001 20:52:13 +0200 (CEST)


Chris Withers writes:
 > > There is currently no such method,
 > > but you could easily create one:
 > > 
 > >     import string
 > > 
 > >     class ZCatalog:
 > >       ....
 > >       def isObjectCataloged(self,object):
 > >         uid= string.join(object.getPhysicalPath(),'/')
 > >         return self._catalog.uids.has_key(uid)
 > 
 > Perhaps that could go in the collector?
I am not sure:

   The catalog is quite flexible. It allows the caller of
   "catalog_object" to specify the uid under which the
   object should be cataloged.
   Only, if the uid is not provided (probably the normal
   use), it is computed from "getPhysicalPath".

   Of course, if it has been provided, the code above
   will break. Thus, "isObjectCataloged" is less general
   than "catalog_object".

   On the other hand, "getObject" will break too, when
   non-standard "uid"s are used. Thus, maybe, the
   "uid" feature should be scrapped.


Dieter