[Zope] Re: [Re: [Zope] can dtml methods take arguments ?]

Andreas Kostyrka andreas@mtg.co.at
Sun, 29 Aug 1999 19:01:39 +0200 (CEST)


On 29 Aug 1999 happyrhino@usa.net wrote:

> Andreas Kostyrka <andreas@mtg.co.at> wrote:
> On 29 Aug 1999 happyrhino@usa.net wrote:
> 
> >> The name "method" suggests that DTML methods should be able
> >> to take arguments much like ZSQL methods can. But for the 
> >> life of me I can't find where these are added. 
> >
> >Well, just use them ;)
> 
> Sorry Andreas, I'm feeling a bit stupid here. You say to just 
> use them so I've been trying variations without any luck.
> 
> Consider a DTML method "dtmNavigation" which contains the following =
> <dtml-with "CommonElements">
> <TABLE WIDTH=<dtml-var mywidth>>
> <TR>
> <!-- ommitted for clarity -->
> 
> 
> So, I'd like to be able to call it with varying values of 'mywidth'.
> I've tried to call dtmNavigation with arguments from a DTML document
> like this =
> <dtml-var "dtmNavigation(mywidth=120)"> 
> 
well, you should add also REQUEST=REQUEST, etc. I believe :(

Andreas
> like standard python functions and methods.
> ie. def functionname( arg1=defaultvalue1, arg2=defaultvalue2)
It cannot.
You can use
<dtml-unless argument>
<dtml-call "REQUEST.set('argument',default)">
</dtml-unless>

> By the way, was there any decision taken on a syntax change from
> <dtml-tag >  to <z-tag > or <dt-tag > because I have to agree
Yes. It was negative. ;)
> that the mere presence of the 'dtml' in the tag makes it much
> harder to read than the Cold Fusion syntax.
Well, that's what people told me that often about python's indentation
syntax. Well, bad news, it's just syntax, and I consider ignoring syntax
(to a certain level) natural for a good developer. (I meant read ignore,
write do not ignore ;) )

Andreas
--
Andreas Kostyrka                     | andreas@mtg.co.at
phone: +43/1/7070750                 | phone: +43/676/4091256   
MTG Handelsges.m.b.H.                | fax:   +43/1/7065299
Raiffeisenstr. 16/9                  | 2320 Zwoelfaxing AUSTRIA