Is it possible using an expression to disallow an object being added to a catalog based on a certain string being contained in its path? For example, I want to include all objects in a subfolder except if the path includes the name 'sample' in the path. I think this may be possible utilizing the "expr" field on the Find Objects tab of a ZCatalog, but I'm not certain how to write the expression. Can anyone offer some advice? Thanks, Kevin
On Monday 02 December 2002 01:43 pm, Kevin Carlson wrote:
Is it possible using an expression to disallow an object being added to a catalog based on a certain string being contained in its path? For example, I want to include all objects in a subfolder except if the path includes the name 'sample' in the path.
I think this may be possible utilizing the "expr" field on the Find Objects tab of a ZCatalog, but I'm not certain how to write the expression. Can anyone offer some advice?
maybe this expr: absolute_url().find('sample') == -1 If it it would only be in the object id: getid().find('sample') == -1 of course YMMV. hth, -Casey
Kevin Carlson writes:
Is it possible using an expression to disallow an object being added to a catalog based on a certain string being contained in its path? For example, I want to include all objects in a subfolder except if the path includes the name 'sample' in the path.
I think this may be possible utilizing the "expr" field on the Find Objects tab of a ZCatalog, but I'm not certain how to write the expression. Can anyone offer some advice? I solve problems of this kind with the following two step approach:
* determine the list of objects in any appropriate way. My favorite is "ZopeFind" (the method behind Zope's "find" tab). * Interate over the list and call "Catalog.catalog_object" for each object. Dieter
participants (3)
-
Casey Duncan -
Dieter Maurer -
Kevin Carlson