[Zope] How do I specify a list element?

Dieter Maurer dieter@handshake.de
Thu, 6 Jul 2000 22:51:53 +0200 (CEST)


asjf11@uaa.alaska.edu writes:
 > I have a list (I think) created this way:
 > 
 > (date = '31-DEC-1999')
 > 
 > <dtml-call "REQUEST.set('MyList', _.string.split(date, '-'))">
 > 
 > so now REQUEST['MyList'] should contain 3 elements: 
 > 31 DEC 1999
 > 
 > How, in dtml, do I say "give me the value of the 1st element of MyList" or 
 > the second or third.
 > 
 > I've tried <dtml-var "REQUEST['MyList'][0]"> but I get this error:
 > 
 > Error Type: TypeError
 > Error Value: argument 1: expected read-only character buffer, 
 > Missing found
 > Now I don't know which part this error is refering to, but anyhow I want 
 > this functionality.
I expect that your "date" looks like a string but in fact
is an object.
In this case, your error does not result from the
"MyList[0]" but from th "_.string.split(date,'-')".
Use "_.string.split(_.str(date),'-')", instead.



Dieter