[Zope] __getitem__ errors on Python Script

Evan Simpson evan@4-am.com
Fri, 16 Feb 2001 16:44:18 -0500


From: Jason Straw <jstraw@towhee.com>
> I am trying to replace my  clunky DTML with this PythonScript.
>
> ## Script (Python) "submita_html"
> ##bind container=container
> ##bind context=context
> ##bind namespace=_
> ##bind script=script
> ##bind subpath=traverse_subpath
> ##parameters=
> ##title=Submit an Assignment
> ##
> print "<html><head><title>" + script.title + "</title></head><body
bgcolor='white'>"
> print '<h2>' + script.title + '</h2>'
> for x in context.classlist:

^^^ Line 4 (Count all of the ## lines as line 1)

>   File Script (Python), line 4, in submita_html
> AttributeError: __getitem__

Looks like context.classlist isn't a sequence, so you can't loop over it.

Cheers,

Evan @ digicool & 4-am