Am Montag, den 04.07.2005, 22:53 +0200 schrieb Negroup -:
Is there some way to pass an object from template A to template B via HTML forms?
A <form name="a" action="b" method="post"> <input type="hidden" name="obj" tal:attributes="value here" /> <input type="submit" value="Press" /> </form>
B <b tal:content="structure here/REQUEST"></b>
Template B prints: form obj '<OrderedFolder instance at 42d9aec0>'
I need the object itself, not the string representing the object!
You cannot simply pass a ZOPE object in a form like that. You can handle fairly complex structures (lists and dictionaries with int, float, string in them) but whole objects would need to be pickled and then open a huge security hole (Whatever is in the client can and will be faked) 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') Btw. avoid much code in the Template. Its a maintenance headache. You can do it esily in a python script and call this from template.