[Zope] ZCatalog question... possible bug
Joel Burton
joel@joelburton.com
Mon, 11 Mar 2002 11:28:38 -0500 (EST)
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