[Zope] question on python script, dtml method and options
Erik Myllymaki
erik.myllymaki at aviawest.com
Tue Jul 19 11:30:44 EDT 2005
I use the following template often. When using a page template for my MAIN page,
I access the error and message vars with:
<p tal:content="options/error">Error message</p>
<p tal:content="options/message">Reg. Message</p>
How would I access them when I use a dtml-method for my MAIN page?
<dtml-var error> and <dtml-var message> don't seem to work.
Python Script - index_html:
# Import a standard function, and get the HTML request and response objects.
from Products.PythonScripts.standard import html_quote
request = container.REQUEST
RESPONSE = request.RESPONSE
error=''
message=''
if not request.has_key('next_state'):
return container['MAIN'](context, request, error=error, message=message)
elif request.get('next_state') == 'Do Something':
try:
doSomething()
message = message + 'We did something'
except:
error = error + 'Error in doSomething()'
elif request.get('next_state') == 'Do Something Else':
try:
doSomethingElse()
message = message + 'We did something else'
except:
error = error + 'Error in doSomethingElse()'
return container['MAIN'](context, request, error=error, message=message)
More information about the Zope
mailing list