[Zope] Pass objects from template to template via HTML forms.

Andrew Milton akm at theinternet.com.au
Tue Jul 5 05:14:20 EDT 2005


+-------[ Negroup - ]----------------------
| 2005/7/5, Tino Wildenhain <tino at wildenhain.de>:
| [cut]
| 
| > So best option I see is to not pass the object but rather
| > pass the reference to the object. You can resolve
| > it via restrictedTraverse('/path/from/form')
| 
| I think I can't apply your solution. restrictedTraverse asks for a
| path, and then it supposes that the object is stored inside ZODB. This
| is not my case. Let me provide a minimanl explaination about how my
| application is structured.
| 
| 1. A user can uploads a zipped file via HTML form in "upload_zip" ZPT.
| The action of the form points to check_zip, an External Method that
| checks for validity of each file inside the archive.
| 
| 2. check_zip returns to upload_zip a tuple containing two elements:
| True or False (based on the correctness of archive) and the object
| itself, via self parameter.
| 
| 3. after the external method has been called, upload_zip shows other 2
| forms that the user will use to abort operation or to continue the
| process. The form to continue will pass the object to another external
| method in order to compute the result. This is the step where I
| encounter the problem, I can't pass object.
| 
| This should explain why I haven't the object stored inside ZODB.
| 
| Probably the solution would be to store the uploaded object inside a
| temporary area of ZODB and then I'll be able to do all the tasks I
| need.
| 
| Any further consideration/hints?

You would be better off storing the file on the filesystem, and pass the
filename around. You'd have to do some sanity checking on the filename before
any manipulation obviously.

-- 
Andrew Milton
akm at theinternet.com.au


More information about the Zope mailing list