Tom Deprez wrote:
> I'm storing a selection of a user to a database as string. This selection
> is a multiple selection from a select box and is outputted as a list.
> Now I want to iterate over this list (after retrieving it from the
> database), but how can I do this? How can I tell Zope that the string is
> actually a list? How can I typecast in Zope?
Use a python or external method to make a list from your string. I am
supposing you are storing a string representation of the list that looks
"['fred', 'bob', 'mary']"
Get rid of any punctuation you do not want with (e.g.)
theString = string.replace(theString, '[', ' ')
(Yes, there are more efficient ways to do this!)
Then, once you have a space-delimited list of items, you may use
theList = string.split(theString)
which will make a list of the words in the string. Return theList.
-- Jim Washington
Zope maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -