[Zope-dev] ZCatalog and indexing DTML methods
Jay, Dylan
djay@lucent.com
Mon, 18 Oct 1999 11:42:16 +1000
> -----Original Message-----
> From: Michel Pelletier [mailto:michel@digicool.com]
> Sent: Monday, October 18, 1999 03:33
> To: zen@cs.rmit.edu.au
> Cc: zope-dev@zope.org
> Subject: Re: [Zope-dev] ZCatalog and indexing DTML methods
>
>
> 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?
I think that some assumtion should be made in general for any call to a DTML
method with no arguments. I think a call to "anInstance.aDTMLMethod()" is an
intuitive thing to do as is
<dtml-with myfolder>
<dtml-var "myMethod()">
</dtml-with>
Is there any reason (other than the fact it would prob be hard to impliment)
that <dtml-var "myMethod()"> can't be equivelent to <dtml-var myMethod>?
If someone wants to explicitly pass no context in they can use <dtml-var
"myMethod(_.None, _.None, _.None)">. An uncommon case I would think anyway.