[ZPT] Are PT's ZCatelog Aware? - Now: Subclassing ZPT's

Lynn Walton waltonl@franklin.edu
Thu, 05 Jul 2001 11:59:04 -0500


Evan,

So, given my situation .. that I'm building a site soon where I want my zpt
pages indexed for a site search, and I can't wait for new versions of ZPT
that might be already catalogable "out of the box", (which I propose by the
way <g>) can you give me a high-level outline of what I should do to make
them available to a ZCatalog?

I am not sure I understand the current state of a ZPT with regard to
ZCatalogs? Are they already catalogable but just not auto-catalogable?  Or
are they neither without me subclassing?    Would it be significantly easier
if I gave up on Automatically Cataloging and went with me having to mass
catalog, or would I still have to do most of the same steps?

Thanks for your patience with my incomplete understanding of this. : )

Lynn


Evan Simpson wrote:

> From: "Lynn Walton" <waltonl@babbage.franklin.edu>
> > Thanks for the opinions. I must admit this is discouraging to me. At
> least
> > to hear that the ZCatalog and related stuff is tricking and somewhat
> > broken.  One of several reasons I chose zope is because of the
> automatic
> > indexing abilities.   It seems to me that if PageTemplates are to be a
> > viable replacement for DTML documents, then being able to be cataloged
> for
> > indexing is a must. Otherwise your saying that any site choosing ZPT
> over
> > DTML has to give up being searchable? That's not going to be
> acceptable for
> > my site and I would guess not for many other sites either.
>
> I think I've really given you the wrong impression.  My warnings have
> nothing to do with ZPT vs. DTML, or even ZCatalog in general.  You
> should be able to catalog and search on ZPT objects just fine, as you
> would any other Zope object.  It's the CatalogAware mixin, that tries to
> make objects automagically catalog and uncatalog themselves, which is
> the problem.  There's a newer CatalogAwareness (I think) mixin class
> that solves some of the technical problems, but the more fundamental one
> comes from the fact that metadata and index references stored in a
> ZCatalog don't get updated unless the ZCatalog is instructed that the
> object has changed.  The old mixin class only touches the ZCatalog when
> the object is created, deleted, or moved, not when it is changed in
> place.  This means that you need to do some work in the subclass to kick
> the catalog whenever the object changes in ways that affect the catalog
> data.  This is true of DTML, user-defined ZClasses, or whatever.  In
> particular, almost all changes to ZPT objects go through the write()
> method, so causing that to kick the catalog will catch most (or possibly
> all) cases.
>
> Cheers,
>
> Evan @ digicool