[reportlab-users] cgi-problem with reportlab
Tim Roberts
reportlab-users@reportlab.com
Wed, 10 Sep 2003 09:54:00 -0700
On Tue, 9 Sep 2003 12:51:30 +0100, Proboscis Admin <admin@proboscis.org.uk>
wrote:
>
>ive made a tool using reportlab but it requires the text to be imported
>from the html form.im using CGI for that but I am getting a key error
>due to the cgi.py module in python which is raising an exception
>because it can not get the text.i think the problem is referring the
>python/reportlab code to the html form does anyone have an idea or
>advice?
>I have used the same input names as in the html form.
You will have to be much more specific. Including snippets of code and the
exact error message are a must.
However, it is much more likely that you have a cgi problem, not a ReportLab
problemn. We might want to redirect this to comp.lang.python.
The cgi.py module can be a bit picky. Your capitalization must match
exactly; if the form has:
<input type=text name=MyText>
then you must use
q = cgi.FieldStorage()
s = q['MyText'].value
Also note that if you do not fill in a field, the field name will not appear
in the FieldStorage object at all. That's a common error. Fortunately, it's
easy to check for that:
if q.has_key('MyText'):
s = q['MyText'].value
else:
s = None
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.