[Zope] csv import continued

garry saddington garry at joydiv.fsnet.co.uk
Sun Aug 8 11:40:45 EDT 2004


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?
regards
garry



More information about the Zope mailing list