Hello all,
I have created:
- a Controller Page Template
- a Controller Validator script and,
- a Controller Python script
I am trying to create a form whose values are used by a script to:
- query a separate reporting system
- generate a .pdf document with the resulting report and,
- post the contents of the .pdf to a results page
I cannot seem to figure out how to generate the results page. Could
anyone shed some light on this?
You will note some poor python code practices (especially in the
validator script) which I apologize for (too hurried), so please be
forgiving...
Thanking you in advance,
Chris Nethery
My code is below. So far, I have the following:
--
PMA (Controller Page Template)
--
The title
Portfolio Manager
Assignment
Enter query parameters:
Portfolio
Group Name
Run Date (mmddyy)
From Date (mmddyy)
To Date (mmddyy)
---
PMAValidators (Controller Validator Script)
---
portfolio = context.REQUEST.get('portfolio', None)
run_date = context.REQUEST.get('run_date', None)
from_date = context.REQUEST.get('from_date', None)
to_date = context.REQUEST.get('to_date', None)
if not portfolio:
state.setError('portfolio', 'Please enter a portfolio')
if state.getErrors():
state.setStatus('failure')
return state.set(portal_status_message='Please correct the errors
shown')
if not run_date:
state.setError('run_date', 'Please enter a run date')
if state.getErrors():
state.setStatus('failure')
return state.set(portal_status_message='Please correct the errors
shown')
if not from_date:
state.setError('from_date', 'Please enter a "from" date')
if state.getErrors():
state.setStatus('failure')
return state.set(portal_status_message='Please correct the errors
shown')
if not to_date:
state.setError('to_date', 'Please enter a "to" date')
if state.getErrors():
state.setStatus('failure')
return state.set(portal_status_message='Please correct the errors
shown')
return state
PMAScript (Controller Python script)
import os
import string
import sys
# Get value(s) from the REQUEST
portfolio = context.REQUEST.get('portfolio')
run_date = context.REQUEST.get('run_date')
from_date = context.REQUEST.get('from_date')
to_date = context.REQUEST.get('to_date')
#Create .pdf
y = stuff
x = os.system(y)
### What now? ###
### state.setNextAction ? ###
return state
___
Zope maillist - Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )