Thanks for everyone's help. I may be able to sort this now.
From: Tino Wildenhain [mailto:[EMAIL PROTECTED]
Sent: 20 June 2006 15:09
To: [EMAIL PROTECTED]
Cc: 'Jaroslav Lukesh'; firstname.lastname@example.org
Subject: Re: [Zope] Nested dtml tags
Jonathan Bowlas schrieb:
> Hmm, this doesn't appear to work.
> Let me explain what I'm trying to do.
> I have a Z SQL Method called selectmoduleinfoMethod that contains the SQL:
> SELECT * FROM RECMGR_EL_MODULE_Query WHERE MODCODE = <dtml-sqlvar
> MODCODE type="string">
You should never use SELECT * in production code. Better state the
name of the columns you really want there. (Thus fixing their name)
One simple form would be:
SELECT modlevel,modname,modlevel=<dtml-sqlvar modlevel> as selected
FROM foobar WHERE modcode = <dtml-sqlvar modcode type=string> ...
Then you could use the result of your ZSQL Method more or less directly,
in ZPT for example:
<select name="MODLEVEL"> (size="1" is default anyway ;)
<option tal:repeat="mod here/yourZSQLMethod"
tal:attributes="value mod/modlevel; selected mod/selected"
In Python Script, it should work like this:
MODLEVEL=request.form.get('MODLEVEL','') # make sure you get the types
return [dict(x,selected=x.modlevel==MODLEVEL) for x in
this works with your ZSQL method as it is (more or less - adjust the column
and can be used like the one above.
If you like ugly templates and a lot of writing you can translate the
example to DTML - this is left to the reader ;)
Zope maillist - Zope@zope.org
** No cross posts or HTML encoding! **
(Related lists -