[Zope-dev] ZCatalog and indexing DTML methods
Michel Pelletier
michel@digicool.com
Sun, 17 Oct 1999 13:32:49 -0400
Stuart 'Zen' Bishop wrote:
>
> Greetings.
>
> I need to use ZCatalog to index computed values of my ZClass.
> It seems that ZCatalog will happily call DTML methods and index
> their output, but the DTML methods are not called with any arguments
> so cannot do very much.
Right.
> At the moment, I'm having to shadow the output of my DTML methods (eg.
> return the Id of PARENTS[1] type stuff) in property sheets to achieve
> the required functionality, but this is ugly.
Yup.
> Is this sort of thing possible with ZClasses, or is this where it
> is worth switching to Python classes?
You might want to step down to Python, especially for 'computable' like
stuff.
> Would it be possible to modify Catalog to do this? I think the
> necessary section to modify would be recordify in Catalog.py.
> The first argument to a DTML Method call would just be the object
> passed to recordify. I'm unsure how to fake up the REQUEST attribute
> though. Is this the right way to proceed?
The problem here is that an assumption is being made, passing an object
in as the first argument to a bound method. The whole argument passing
concept in general is ripe with complication, as everyone and their
brother is going to want to call a method their way, although I do agree
that calling DTML methods with a context is useful.
I'll have to think about this a bit to see if there is a general
solution, in the mean time you can of course modify your code (you found
the right spot). Anyone else have any ideas?
-Michel