Tim Cook wrote:
> Kapil Thangavelu wrote:
> > >
> > --------->>>>>> <dtml-call "REQUEST.set('day_list', period_begin)">
> > > <dtml-call "REQUEST.set('done_list', [])">

> > When you call request.set your setting daylist to the method not the
> > results of the method. try switching it to
> >
> > <dtml-call "REQUEST.set('day_list', period_begin(_.None, _))">
> >
> > Kapil
> >
> But, your suggestion did correct the problem that I had.
> So, as a newbie warning to others just because it renders
> correctly doesn't mean that it's behavior is going to be correct
> in a programmatic sense.
> So, why did the dtml-call or dtml-var calls cause the add_weekly
> method to work?
> (Too many years of procedural code and not enough OOP zen!).

If it makes you feel any better it has nothing to do with your OOP Zen.

This exists as an artifact of the idiosyncracies of DTML.

so take a dtml-var statement

<dtml-var foobar> 


<dtml-var "foobar">

Most DTML tags automajically call an item and marshall in the
proper arguements. if you escape from pure dtml to pythonish dtml "",
than you
need to make your calls explicity since you're writing in a safe sub
dialect of python 
not in DTML. the args you're passing in if memory serve, are the client
object, a mapping object, and keyword args. 

taking the above calls as example and assuming foobar is a dtml method
that returns a list containing [1,2,3,4]. than the first method would
render the list and the second would render a hidden tag (view source to
look at it) something like <DTML METHOD OB MEMORY REF>, not what you
what wanted. The solution is first to call it like a python function (),
and to pass it the default args.

<dtml-var "foobar(_.None, _)">

this passes it None for a client, and the current namespace as the
mapping, and no keyword args.

hope that was clearer than mud.


Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to