Manually take in variables in Python method.
To begin with, I am a "newbie". I can though do my own Python scripts and simply connect them to my zope. What I do (having created an External Method) to use querystrings in my python code is this. <dtml-var "the_python_Id(MyQuerystring1, MyQuerystring2)"> (the querystrings are for example name, email, age, ... and not MyQuerystring(n)) And my python code returns something based on these inputs. What if I have very many inputs. Because on a Zope page of mine I have a huge form with a lot of input and I want to be able to pass all of that into a python module. Is there any nifty way of doing this, with loops or "take-it-all-in-the-module". The simple way would be to write down all querystrings seperated by a comma , In ASP you can write: "For Each item in Request.Form" Any Ideas?
I haven't seen a response to this, and it's a bit dated, but here goes ... Peter Bengtsson wrote:
What I do (having created an External Method) to use querystrings in my python code is this.
<dtml-var "the_python_Id(MyQuerystring1, MyQuerystring2)"> (the querystrings are for example name, email, age, ... and not MyQuerystring(n))
And my python code returns something based on these inputs.
What if I have very many inputs.
Just pass in REQUEST to your External Method. eg (from memory): DTML Method: <dtml-var "the_python_Id(REQUEST)"> External Method: def the_python_method(self, REQUEST): for key, val in REQUEST.form.items(): pass # Or whatever. Regards, Daryl Tester
participants (2)
-
Daryl Tester -
Peter Bengtsson