[Zope] upload a file to external method

robert rottermann robert at redcor.ch
Fri Aug 6 16:04:04 EDT 2004


What does not work?
Does it produce an error? traceback.

I *think* you have to read the stud object you get from REQUEST.
You best check how OSF/Image.py does handle this.

Robert

garry saddington wrote:
> I have a form which uploads a file called students.csv and i want to feed this 
> file into an external method. As far as I have got is below - this is the 
> contents of the external method, can anyone help correct this as it does not 
> work. Hopefully it should read a .csv file, output a dictionary and feed this 
> to the ZSQL method writestudents.
> 
> ## Script (Python) "handlestudents"
> ##bind container=container
> ##bind context=context
> ##bind namespace=
> ##bind script=script
> ##bind subpath=traverse_subpath
> ##parameters=REQUEST
> ##title=
> ##
> 
> def students(self,REQUEST):
>   import csv
>   stud=REQUEST.form["students.csv"]
>   fieldnames=["firsname","surname", "year", "form","gender"]
>   reader = csv.DictReader(stud,fieldnames)
>   for row in reader:
>     self.writestudents(row)
> 
> regards
> garry
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 
> 


More information about the Zope mailing list