PS: my example assumes you _only_ want passed arguments to be usable to the
DTML method you are calling -
if you want to pass parameters And get the default namespace, you have to
pass it ('_') also.  My util methods
that use params Only use those params (I try to keep a clean interface) -
but yours might not...

>-----Original Message-----
>From: Jon Franz 
>Sent: Friday, January 26, 2001 2:07 PM
>Subject: Re: [Zope-dev] Passing arguments to DTML Methods
>This is an undocumented (afaik) feature of DTML methods/documents - due to
the way python
>argument mapping works, you can pass any value into a 'local' variable in a
DTML method like thus:
><dtml-var "myDTMLmethod(foo=5,greg=Sally)">
>this the above case, Sally could be a legal variable value that will be put
into the new local greg
>in your DTML method, and one named foo with the value of 5.  AFAIK this is
pass-by-value, so modifying greg in your called method >will not change
sally, but I could be wrong...
>I use this sort of thing quite often in one of my ongoing projects where I
need to reformat
>dates strings from their mysql format to how the client wants to view
them... I have a method named
>undb_dateout that uses a variable called 'dbdate' and does some string
splitting and formatting to output it.
>Originally, I would do things like this with the method:
><dtml-call "REQUEST.set('dbdate', currentdatevar)">
><dtml-var undb_dateout>
>Then, on a whim I changed this to:
><dtml-var "undb_dateout(dbdate=currentdatevar)">
>And it worked...
>Someone should add this to the DTML documentation, or at least make it
stand out more - it is VERY
>useful... If no one else does I'll write-up a how-to on it.
>>Message: 7
>>Date: Thu, 25 Jan 2001 19:13:59 +0000 (GMT)
>>From: Espen Sorbye Frederiksen <[EMAIL PROTECTED]>
>>Subject: [Zope-dev] Passing arguments to DTML Methods

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to