Terry Babbey writes:
 > Here is my code and my error.
 > 
 > <dtml-in "_.getitem(ProgCode,0).CL">
 > <dtml-let item=sequence-item>
 >   <dtml-var "item[0]">
 > </dtml-let>
 > <BR>
 > </dtml-in>
 > 
 > Zope has encountered an error while publishing this resource.
 > 
 >            Error Type: IndexError
 >            Error Value: string index out of range
 > 
 > CL is a property of a dtml document and is a list of courses for a
 > given program. My goal is to test character 8 of each line and if it
 > is a - (dash) then it represents a course name which I will usr to
 > point to a course description.
 > Any help?
One of the list elements is empty, there is no index "0".

Try:
        <dtml-if "item[7:8] == '-'">
          .... contains '-' as 8.th character ....
        </dtml-if>

"item[7:8]" gives the 8.th character, if it exists, and otherwise
the empty string.



Dieter

_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to