[Zope] How to handle file uploads in python?

Chew Meng Kuan mengkuan@lga.net.sg
Thu, 28 Oct 1999 20:16:06 +0800


Hi,

I was able to create a simple ZClass to handle uploads/file attachment.
No problem there.

Next I want to do the same thing but use python instead with Jeff Rush's
Poll product as a template. I'm currently stumped on the following piece
of code:

def manage_edit(self, field1, field2, field3, attachment,
                    SUBMIT='Change', REQUEST=None):
        "Store Away Possibly-Modified Basic Attributes"

        self.field1 = field1
        self.field2 = field2
        self.field3 = field3

        try:    manage_addFile(id=attachment.filename, file=attachment)
        except:	pass

	<snip>


which only results in the following error message

Error Type: IOError
Error Value: [Errno 5] I/O error

The python class subclasses CatalogAware as well as OFS.ObjectManager as
I was hoping to be able to place the uploaded file in the object itself.

I've scoured the mailing list as well as looked at the source code of
some products but to no avail. Any ideas?

Thanks,
Meng Kuan