|
Ron Phelps
rphelps at redshift.com
Sun Feb 8 19:45:52 EST 2009
I am using a simple publisher example from 2005 that prompts the user to
select a month of the year and I think it is to return a html page to
the browser with a formatted month. However, instead of returning the
html Firefox prompts me to save the file or open with another
application. Do I need to add the Publisher handler in the apache2.conf
file?
Ron
Here's the code.
<title>A simple "get month" script</title>
<body>
<form method="POST" action="python/getMonth.py">
<p>
<hr>
<br />
Show which month for 2005?: <br />
<select name="month">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<br />
<input type="submit" value="Show Month">
</form>
</body>
# A simple script to output a calendar month based off input
# from a web form.
#
import calendar
from mod_python import apache
def getMonth(req,month):
req.write(calendar.month(2005, int(month),2,3))
Apache config
<VirtualHost *>
ServerAdmin webmaster at localhost
DocumentRoot /var/www/tlm/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/tlm>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
#Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0
# Deny from anywhere but this machine
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0
</Directory>
<Directory /var/www/tlm/>
SetHandler mod_python
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
</VirtualHost>
|