[Zope] csv import

Roché Compaan roche at upfrontsystems.co.za
Sun Aug 8 10:09:05 EDT 2004


* garry saddington <garry at joydiv.fsnet.co.uk> [2004-08-08 15:42]:
> I am trying to use the Python csv module to import a csv file into zope and 
> then write the result to a RDBMS. The csv module requires an iterable file 
> but the fileupload instance returned by:
> 
> file=REQUEST.form("filename")
> 
> Does not seem to be iterable. Is there a way to make it so?

Mmm, I think you should log an issue in the collector that FileUpload
instances should be iterable. In the mean time type you can convert it
to StringIO instance:

    file=REQUEST.form("filename")
    from cStringIO import StringIO
    iterable = StringIO(file.read())


-- 
Roché Compaan
Upfront Systems                 http://www.upfrontsystems.co.za


More information about the Zope mailing list