[Zope] Extending the catalog, LazyMaps and non-persistent classes ...

Paul Winkler pw_lists@slinkp.com
Thu, 5 Jun 2003 05:34:14 -0400


On Thu, Jun 05, 2003 at 10:36:11AM +0100, Chris Withers wrote:
> Jean-Francois.Doyon@CCRS.NRCan.gc.ca wrote:
> >
> >I have a bit of a hairy requirement: I need to extend the catalog to find
> >content that exists outside of Zope (more or less, hard to explain without
> >getting into details).
> 
> I'm sure there's a how-to for this already...

yep! First hit here:
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=zope+catalog+anything

> >So, what I thought is, I could hack the underlying catalog code (the
> >search() method of Catalog.py) to add some functionality that would execute
> >the search, take the XML results, parse it, and append the results to the
> >LazyMap instance. I would now have a single list of search results for both
> >types of searches.  Also, I'm pretty sure this can be achieved through a
> >monkey patch, so it's fairly portable and separate from the Zope core.
> >(Though admitedly I'm not sure I understand the LazyMap/LazyCat thing too
> >well just yet).
> 
> This sounds like a recipe for trouble :-S

Indeed. just follow Ron's excellent howto, but instead of a ZSQL Method,
create a script that returns a list of objects, each of which represents
one of the results. Each result object should have attributes
or methods corresponding to your catalog indeces. You could do this in
an External Method that uses httplib or urllib or whatever, to make 
calls to a remote server and parse the results.

Once you have a list of such objects, putting them in the catalog
is very easy according to the howto.

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's PRO CLERK-MAN!
(random hero from isometric.spaceninja.com)