[Zope] __getitem__ errors on Python Script

Jason Straw jstraw@towhee.com
16 Feb 2001 14:16:36 -0500


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:
  if (x.username == other.AUTHENTICATED_USER):
    print 'Welcome ' + x.fname + ' ' + x.lname + '<br>\n'

print '<form action="submitAssign" method="post"
enctype="multipart/form-data">'
for x in context.selectassigns:
  if lock == 0:
    print "<input type='radio' name='name1' value='" + name + ">'>" +
name +': ' + description + '<br>\n'
  else:
    print "<b>Submissions for " + name + " have been locked.</b><br>\n"


for x in context.classlist:
  if (username == other.AUTHENTICATED_USER):
    print "<input type='hidden' name='username' value='" + lname + '_' +
fname + "'>"

print "Choose File to upload:<input type='file' name='file_name'><br> "
print "<input type='submit' value='submit assignment'> <input
type='reset'> <br> "
print "</form>"

return printed
________________________________________________________
When I test it I get a Attribute Error(Traceback Below)


Error Traceback:
  Traceback (innermost last):
  File /usr/Zope/Zope-2.3.0-src/lib/python/ZPublisher/Publish.py, line
171, in publish
  File /usr/Zope/Zope-2.3.0-src/lib/python/ZPublisher/mapply.py, line
160, in mapply
    (Object: submita_html)
  File /usr/Zope/Zope-2.3.0-src/lib/python/ZPublisher/Publish.py, line
112, in call_object
    (Object: submita_html)
  File
/usr/Zope/Zope-2.3.0-src/lib/python/Shared/DC/Scripts/Bindings.py, line
324, in __call__
    (Object: submita_html)
  File
/usr/Zope/Zope-2.3.0-src/lib/python/Shared/DC/Scripts/Bindings.py, line
353, in _bindAndExec
    (Object: submita_html)
  File
/usr/Zope/Zope-2.3.0-src/lib/python/Products/PythonScripts/PythonScript.py, line 330, in _exec
    (Object: submita_html)
    (Info: ({'script': , 'context': , 'container': , '_': ,
'traverse_subpath': []}, (), {}, None))
  File Script (Python), line 4, in submita_html
AttributeError: __getitem__


Any Help that I could get/Documentation to look at would be most useful

Jason Straw
jstraw@towhee.com