[Zope] ZSQL and variables in attribute tags in <dtml-sqlvar> ...
adam
adam@centurysoftware.com.au
Thu, 6 Jun 2002 13:13:32 +0800
Hi all,
Ive been working on a ZSQL method that looks up in a supplied data structure
to determine how to insert.. the argument to VALUES looks like:
values (
<dtml-in "REQUEST.SESSION.get('p_dict')" prefix="loop">
<dtml-if "loop_sequence_item['type'] == 'nb'">
<dtml-sqlvar "form[loop_sequence_item['name']]" type=nb>
<dtml-elif "loop_sequence_item['type'] == 'int'">
<dtml-sqlvar "form[loop_sequence_item['name']]" type=int>
<dtml-elif "loop_sequence_item['type'] == 'float'">
<dtml-sqlvar "form[loop_sequence_item['name']]" type=float>
<dtml-elif "loop_sequence_item['type'] == 'string'">
<dtml-sqlvar "form[loop_sequence_item['name']]" type=string>
</dtml-if>
<dtml-if sequence-end>
<dtml-else>,
</dtml-if>
</dtml-in>
)
.... which is not the best.. what I want to do is:
[...]
<dtml-in "REQUEST.SESSION.get('p_dict')" prefix="loop">
<dtml-sqlvar "form[loop_sequence_item['name']]" type="<dtml-var
"loop_sequence_item['type']">">
</dtml-in>
[...]
but this doesn't work of course ;)... are there any suggestions on how to
refine?
Many thanks and regards,
Adam