Re: [Zope] Populating a :list variable from the results of a ZSQL method
don't know about inside zope, but in plain python you could just do: new_options = list(options) perhaps an external method would cut it: return list(inputstring) -- Geir Bækholt web-developer/designer geirh@funcom.com http://www.funcom.com on Friday, November 10, 2000 Tony McDonald wrote : TM> Hi all, TM> Say I've got a form with this in it TM> <select type="checkbox" name="options:list"> TM> <option value="1">number 1 TM> <option value="2">number 2 TM> <option value="3">number 3 TM> </select> TM> When this is put into an SQL database, the field 'options' is this (string) TM> ['1', '2', '3'] or ['2', '3'] etc. TM> When I get the data back from the database, 'options' comes back as a TM> string, and <dtml-in options> ... </dtml-in> gives errors (basically, TM> it can't iterate over a string). TM> I tried TM> <dtml-call "REQUEST.set('new_options:list', options)"> TM> and then tried iterating over new_options, but the variable didn't exist... TM> Has anyone got any solutions for this? TM> TIA TM> Tone TM> ------ TM> Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/ TM> The Medical School, Newcastle University Tel: +44 191 222 5116 TM> A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope TM> _______________________________________________ TM> Zope maillist - Zope@zope.org TM> http://lists.zope.org/mailman/listinfo/zope TM> ** No cross posts or HTML encoding! ** TM> (Related lists - TM> http://lists.zope.org/mailman/listinfo/zope-announce TM> http://lists.zope.org/mailman/listinfo/zope-dev )
On 10/11/00 10:45 am, "Geir Bækholt" <geirh@funcom.com> wrote:
don't know about inside zope, but in plain python you could just do:
new_options = list(options)
Yup - trying to do it all in DTML though...
perhaps an external method would cut it:
return list(inputstring)
The code that Chris Withers sent out might be the way to do it, but you've got to be careful of the eval()... def eval_options(self): return eval(self.REQUEST['options']) Thanks for the thoughts Geir Tone ------ Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/ The Medical School, Newcastle University Tel: +44 191 222 5116 A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope
participants (2)
-
Geir B�kholt -
Tony McDonald