[ZPT] Basic File Upload Question

John Westenberg WESTENBJ@seiu.org
Wed, 25 Sep 2002 10:34:17 -0400


Hi,

I'm new to zope and ZPT and I need help with a very basic issue.  I'm =
having a hard time finding examples in any of Zope's documentation.  I =
have a form that uploads a tab delimited text datafile which I want to =
display in an html table.  I have the form call an External method which =
accepts self and REQUEST as parameters:

def upload(self, REQUEST):
    global dict
    dict=3D{}
    db=3DREQUEST.form['uploadfile'].readlines()
    i=3D0
    for record in db:
        newrecord=3Dstring.split(record, '\t')
        dict[newrecord[i]]=3Dnewrecord
        i=3Di+1
    return context.responseTemplate(dict)

I keep getting 'unkown global name context' or 'container when I try =
either method.

Can someone show me actual code where the output of a dictionary is =
displayed in a template.  Also, could someone explain how either container =
or context objects would be used in this case?

Thanks

=20