[Zope] csv import continued
garry saddington
garry at joydiv.fsnet.co.uk
Sun Aug 8 15:29:32 EDT 2004
On Sunday 08 August 2004 5:37 pm, Jim Washington wrote:
> garry saddington wrote:
> > Now i have an iterable file for the csv module in this code:
> >
> > def students(self,REQUEST):
> > import csv
> > f=REQUEST.form["students.csv"]
> > from cStringIO import StringIO
> > filebody=StringIO(f.read())
> > reader = csv.DictReader(filebody,("firsname","surname",
> > "year","form","gender"))
> > for row in reader:
> > self.writestudents(row)
> >
> > Writestudents is a zsql method with the following body:
> >
> > insert into students (firstname,surname,year,form,gender)
> > values(<dtml-sqlvar firstname type="string">,
> > <dtml-sqlvar surname type="string">,
> > <dtml-sqlvar year type="int">,
> > <dtml-sqlvar form type="string">,
> > <dtml-sqlvar gender type="string">)
> >
> > Now when i test this combination i get a missing input variable error:
> >
> > Missing input variable, firstname
> >
> > Can anyone see what I am missing?
>
> If you copied-and-pasted the code, you have "firsname" instead of
> "firstname" in the "reader" line of "students".
>
> I would look at that first.
>
> --Jim Washington
Thanks -what a dummy! I've got it working now. Thanks for all the help from
this list it is an invaluable source of expertise.
kind regards
garry
More information about the Zope
mailing list