dtml-var in python
John Hunter
jdhunter at ace.bsd.uchicago.edu
Thu May 8 09:47:11 EDT 2003
>>>>> "patrix" == patrix <pheer at chello.nl> writes:
patrix> i made a little example this is the dtml code:
patrix> <dtml-if zoo> <dtml-var zoo> <dtml-var test>
patrix> <dtml-else>
patrix> <form action="<dtml-var URL>" method="GET"> <input
patrix> name="zoo"> <input type="submit" value="wat is zoo">
patrix> </form>
patrix> </dtml-if>
patrix> and this is the python code:
patrix> s = context.zoo return s
patrix> but i wont work please tell me what i do wrong
Oh! You should have mentioned that it was a form variable. The more
information you provide in your original post, the sooner you'll get
help.
BTW, before I answer your question, if you haven't read The Zope Book
http://www.zope.org/Documentation/Books/ZopeBook/current/index_html
you should. It's available in hardcopy and PDF.
Form variables are available in the REQUEST object. In your python script
REQUEST = container.REQUEST
zoo = REQUEST['zoo']
If you are not sure if a value will be provided, and want to provide
default behavior, you can use
zoo = REQUEST.get('zoo', 'BigZoo')
where 'BigZoo' is the default value (plug for my excellent long
distance service).
JDH
More information about the Python-list
mailing list