[Zope] Populating a :list variable from the results of a ZSQL
method
Tony McDonald
tony.mcdonald@ncl.ac.uk
Fri, 10 Nov 2000 11:06:40 +0000
On 10/11/00 10:52 am, "Phil Harris" <phil.harris@zope.co.uk> wrote:
> tone,
>
> How about (untested):
>
> where 'dboptions' is the string pulled from the DB, and 'options' is the
> list needed.
>
> <dtml-call "REQUEST.set('options',[])">
> <dtml-in "_.string.split(dboptions[1:-1],',')">
> <dtml-call "options.append(_.int(_['sequence-item']))">
> </dtml-in>
>
> This would then give you take the string "['1','2','3']" and turn it into
> the list [1,2,3].
>
> hth
>
> Phil
Aha! That's just about what I'd come up with before. Ok, well to be honest I
actually got as far as the string.split and ended up using a _.string.find()
construct to get a pseudo-lookup working :)
I suppose to make it more generic, you'd lose the _.int() part.
Thanks for the info Phil.
------
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