[Zope-dev] CatalogAwareness for RackMountables
Phillip J. Eby
pje@telecommunity.com
Tue, 30 May 2000 16:17:00 -0500
At 12:53 PM 5/30/00 +0300, Itamar Shtull-Trauring wrote:
>I've been playing around with ZPatterns, and I must say it's very cool -
>finally you can mix ZCatalog and SQL storage. CatalogAwareness is slightly
>different than regular Zope objects in that you have to find the ZCatalog in
>the Rack's acquisition path, but that's about it.
IMHO, you don't need to keep referring to self._v_rack to do the cataloging
as described, so long as you retrieve your objects from a Specialist; then
the acquisition path is via the Specialist. I would suggest that you
modify your patches somewhat to reflect this, and use only self.*
attributes, not self._v_rack.*. It will improve your forward-compatibility
with 0.4.0.
>The absolute_url function I define here should be moved to the RackMountable
>class since it may be useful in other situations.
I have to disagree with this, since the standard Zope absolute_url method
will work correctly, so long as you access a RackMountable by traversing
(via bobo_traverse) from a Specialist. If you would like to make your work
easier with version 0.3.0, it would be best for you to move the __of__
wrapping from Specialist.__bobo_traverse__() to Specialist.getItem(), as I
have done in the working copy of 0.4.0. This will ensure that whenever you
retrieve a rackmountable from a Specialist, it will be wrapped in context
of the Specialist.
Then, by deriving your classes from RackMountable and CatalogAware, you
need only adjust for the absence of add and delete hooks. And you'll only
need to adjust for that until 0.4.0 makes add/change/delete hooks available
for indexing agents. I don't know if there will be a Catalog IndexAgent
released with 0.4.0 yet, but there should be one eventually (or perhaps
someone will contribute one).