[Zope-dev] Q: Specialists, Racks, and ZCatalogs?
Michael Bernstein
webmaven@lvcm.com
Sat, 03 Feb 2001 09:23:26 -0800
Steve Alexander wrote:
>
> Michael Bernstein wrote:
> >
> > 'BookProduct' product
> > *'BookClass' ZClass (inherits from
> > _ZClass_for_CatalogAware, _ZClass_for_DataSkin)
>
> Don't derive from CatalogAware when you're also deriving from DataSkin.
Ok.
> Rather than use the CatalogAwareness mechanism to
> manually call reindex() when your object changes, you
> should use some SkinScript in your Specialist or in your
> Customizer to catalog, uncatalog and recatalog on changes.
>
> WHEN OBJECT ADDED CALL
> Catalog.catalog_object(self, _.string.join(self.getPhysicalPath(),'/'))
> WHEN OBJECT DELETED CALL Catalog.uncatalog_object(_.string.join(self.getPhysicalPath(),'/'))
> WHEN OBJECT CHANGED CALL Catalog.uncatalog_object(_.string.join(self.getPhysicalPath(),'/')),
> Catalog.catalog_object(self, _.string.join(self.getPhysicalPath(),'/'))
Thanks, Steve. I'll try this a little later today. What are
your thoughts on placing this in the Specialist's 'Plug-ins'
tab vs. the Rack's?
> [snip]
> > Also, I would like to replace the three indexes I'm
> > maintaining on the books with a single text index on a
> > computed attribute. I understand that this involves adding a
> > SkinScript to the Rack containing something like 'WITH SELF
> > COMPUTE AllText=AllTextMethod', but I'm unsure of the
> > details. I have a method (AllTextMethod) on the ZClass that
> > returns several fields concatenated as a single string,
> > which I would like to use as a text index.
>
> You don't need a method for this; do it all with SkinScript like this:
>
> WITH SELF COMPUTE
> all_text='%s %s %s' % (title, headline, content)
Thanks again, Steve.
Cheers,
Michael Bernstein.