[Zope] forward FileUpload objects through methods

Andreas Pakulat apaku at gmx.de
Fri Dec 3 12:25:19 EST 2004


Hi,

I've got a weird thing here. I have a function A in a product class that
adds a file to the class instance via a HTTP-FileUpload. This function
can be called via a form action directly, but I have some pages where the
form action needs to be a different method B (of the same class) and
also the names for the form fields have to be different. What I do
then in the function B is create a dictionary prop and for all
FileUpload objects from the form I create an entry in the dictionary
with the apropriate name (that is used in function A) and afterwards I
execute function A with prop as parameter. But if I return the props
from function A I get a "string" for the FileUpload entrys not a
FileUpload Instance! Is this known, is there a workaround?

Andreas

PS: To Illustrate this:

class B:
	function A(self, REQUEST):
		f = REQUEST['file1']
		if not f.filename in folder.objectIds():
			folder.manage_addProduct['OFSP'].manage_addFile(id='',title='',file=f)
		[.. more files to add]

	function B(self, REQUEST):
		prop = {}
		prop['file1'] = REQUEST['file1fol']
		self.A(prop)

-- 
A vivid and creative mind characterizes you.


More information about the Zope mailing list