ZCatalog question... possible bug
I'm using ZCatalogs and I seem to have come upon either a bug or a feature that I'm not liking. I have these three items in cataloged: /company/101578039896 /company/101578039896/101578056020 /company/101578039896/101578050712 Each is a folder with properties. The first one has a property called latestRevision. The second and third objects don't have the latestRevision property. When I add a meta_data column (latestRevision) for the catalog, all three objects get the latestRevision property that the first object has. (In other words, it seems that the 2nd and 3rd objects are inheriting properties from the folder above them.) It doesn't seem like it should work that way. Any ideas? --andy.
On Mon, 11 Mar 2002, Andrew Sydelko wrote:
I'm using ZCatalogs and I seem to have come upon either a bug or a feature that I'm not liking.
I have these three items in cataloged:
/company/101578039896 /company/101578039896/101578056020 /company/101578039896/101578050712
Each is a folder with properties. The first one has a property called latestRevision. The second and third objects don't have the latestRevision property. When I add a meta_data column (latestRevision) for the catalog, all three objects get the latestRevision property that the first object has. (In other words, it seems that the 2nd and 3rd objects are inheriting properties from the folder above them.)
It doesn't seem like it should work that way.
This is, however, completely the point of acquisition. It's just the way Zope is and it's the reason I love Zope. But, in your circumstance, it isn't what you want. Life can be like that. Workaround: * create a python script in /company (or closer to the root) called something like "GetExplicitRevision". Set it to return getattr(context.aq_explicit, "latestRevision", None) And have your ZCatalog collect the results of folder.subfolder.GetExplicitRevision, rather than folder.subfolder.latestRevision There might be a way to do this directly w/ZCatalog w/o creating the PyMethod. I don't know it, but would be interested in it if someone figures it out. brief explanation: aq_explicit is a wrapper for an object in Zope that, when queried for attributes/subobjects, doesn't return acquired objects, only direct objects. HTH. -- Joel BURTON | joel@joelburton.com | joelburton.com | aim: wjoelburton Independent Knowledge Management Consultant
On Monday 11 March 2002 11:28, you wrote:
Workaround:
* create a python script in /company (or closer to the root) called something like "GetExplicitRevision". Set it to
return getattr(context.aq_explicit, "latestRevision", None)
And have your ZCatalog collect the results of folder.subfolder.GetExplicitRevision, rather than folder.subfolder.latestRevision
I'm not sure how to get ZCatalog to use the python script to get the latestRevision field... --andy.
On Mon, 11 Mar 2002, Andrew Sydelko wrote:
On Monday 11 March 2002 11:28, you wrote:
Workaround:
* create a python script in /company (or closer to the root) called something like "GetExplicitRevision". Set it to
return getattr(context.aq_explicit, "latestRevision", None)
And have your ZCatalog collect the results of folder.subfolder.GetExplicitRevision, rather than folder.subfolder.latestRevision
I'm not sure how to get ZCatalog to use the python script to get the latestRevision field...
Just tell ZCatalog to index on GetExplicitRevision. It will acquire up and find it and apply it in context of the object. There's the good side of acquisition for you. ;-) -- Joel BURTON | joel@joelburton.com | joelburton.com | aim: wjoelburton Independent Knowledge Management Consultant
participants (2)
-
Andrew Sydelko -
Joel Burton