Am Dienstag, den 05.07.2005, 16:47 +0200 schrieb Negroup -:
2005/7/4, Negroup - <negroup@gmail.com>:
Is there some way to pass an object from template A to template B via HTML forms? [cut]
Thanks a lot for the replies. I have considered all the solutions and at the end I have decided to store the uploaded file in a zope file object inside ZODB, passing it between zope and external methods in order to process it, and then remove the file from ZODB.
This is the last thing I wanted to do, but considering the traps I encountered storing objects inside the session (Error Type: TypeError, Error Value: can't pickle function objects), and considering also that the file uploaded by the user could be potentially very big in size, I have thougt that store it inside ZODB instead of a session object was a better solution.
P.S. I just discovered a mail that looks like mine: http://mail.zope.org/pipermail/zope/2001-August/098793.html Probably in 4 years a lot of people have met the same "problem", but still there is no solution to face it in the terms expressed in my initial post; so, finally, is it impossible to implement a such thing or it simply has never been done?
Well err. You have got all possible solutions: create object in ZODB and pass references around, create object in session (which is easy, you just store the string with the data) or send the data in the form between client and server. (Your error you mention above indicates you did not really create an object or used atomic datatypes) All methods have drawbacks and advantages. Despite of having the user select the same file again to send (which would be the 4th solution) there is none left. This isnt genuine to zope but inherent to all solutions which work over HTTP. I'd suggest to skip the 2-phase upload in favour of a one shot with all the relevant data. E.g. "[ ] check here if you want this and that" in the same form as the file gadget. Especially if the files are potentially large.