Women in Technology

Hear us Roar



Article:
  Mod_python's PSP: Python Server Pages
Subject:   problem executing template example
Date:   2004-12-21 08:40:05
From:   ChristianPinedo
Hi,


I can not execute the template example at a GNU/Linux workstation with apache2 and mod_python 3.1.3. Whenever I tried it, the browser (Firefox 1.0 and Epiphany 1.4.5) downloaded a file that was the generated html page but not browsed it.


To solve this I had to add a line to pubpsp.py:



def hello(req, name=''):
s = 'Hello. there!'
if name:
s = 'Hello, %s!' %
name.capitalize()
req.content_type = 'text/html' # this !!
tmpl = psp.PSP(req, filename='hello.tmpl')
tmpl.run(vars = {'greets': s})
return


This is the only solution i have found.