[Zope] Extending the catalog, LazyMaps and non-persistent classes ...
Jean-Francois.Doyon@CCRS.NRCan.gc.ca
Jean-Francois.Doyon@CCRS.NRCan.gc.ca
Wed, 4 Jun 2003 17:00:14 -0400
Hello,
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).
The idea is that everytime a site search is executed, at the same time =
a
web-service type call should be made to a seperate server, which also
returns a lists of results (XML encoded).
I would like to be able to "amalgamate" both into a single list of =
search
results.
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).
Now when all this is done, I need to make sure that getObject() can =
work on
those custom results, and that proper attributes/methods are in place =
(at a
minimum to do what I need, which is just 2 or 3 calls), which brings me =
to
the second part of the question: non-persistent classes. I need to =
have
instances of a class that aren't stored or permanent, they exist only =
if
getObject() is called (Which it is,though I wonder if I could get rid =
of
that).
Exactly how do I do such a thing? I'm not even sure! I've allways =
created my
product classes by inhertiting from other classes! I'm pretty sure =
that's
not what I want to do here, first of all because this class would be =
fairly
unique, and because I'm pretty sure if I did (from, say CMF Document), =
it
would inherit it's persistent properties.
Does anyone have an example of such a class ? I've seen references to a
"Base" or "SimpleItem" class, but I'm not clear on these, so I'd rather =
get
an informmaed opinion on this.
Oh, and BTW, some of you are probably wondering why not index the =
results in
the catalog ... Well, I suppose I could ... One problem is there are =
LOTS of
items to index, it would grow the catalog quite large and slow it down =
...
the web service comes out of a fairly optimized oracle, MUCH faster. =
Though
I may try this if I can't accomplish the first part of the work. =
Either
way, I'll need these non-persistent classes.
Oh, and Deiter, thanks for the thing on ZPT's equivalent to HTML(), =
I'll be
testing it out soon :)
Any help, tips, commments, or alternative suggestions would be MUCH
appreciated ...
Thanks in advance,
Jean-Fran=E7ois Doyon
Internet Service Development and Systems Support
GeoAccess Division
Canadian Center for Remote Sensing
Natural Resources Canada
http://atlas.gc.ca
Phone: (613) 992-4902
Fax: (613) 947-2410