|
Claudio
realtega at gmail.com
Tue Jul 12 11:25:50 EDT 2005
Sorry, try
from mod_python import apache, psp
def handler(req):
template = psp.PSP(req, filename='../hello.html')
req.content_type = "text/html"
req.send_http_header()
template.run({'what':'world'})
return apache.OK
Claudio
Il giorno mar, 12/07/2005 alle 10.59 -0400, Joshua Cohen ha scritto:
> Hello everyone.
>
> I am attempting to use PSP as a template for outputting Python programs. The problem I am having is when I run the example given in the Mod_Python doc's, Firefox displays the full source as the output. The variables will be replaced as specified, however all of the source is visible on the page. e.g:
>
> The output on Firefox is:
>
> <html>
> <!-- This is a simple psp template called template.html -->
> <h1>Hello, world!</h1>
> </html>0
>
> However, Internet Explorer displays the output properly and all that is output is :
>
> Hello, world!
> 0
> Has anyone else seen this problem?
>
> Here is my code:
>
> Template File:
>
> <html>
> <!-- This is a simple psp template called template.html -->
> <h1>Hello, <%=what%>!</h1>
> </html>
>
> Python Source:
>
> from mod_python import apache, psp
>
> def handler(req):
> template = psp.PSP(req, filename='../hello.html')
> template.run({'what':'world'})
> return apache.OK
>
> Thanks!
>
> Josh
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
|