pit.grinja at gmx.de
pit.grinja at gmx.de
Sun Jan 9 04:14:34 EST 2005
Hello, I have recently started to explore Server-side scripting with modpython, and I am really impressed by its features. Without mod_python, things would have been much more difficult. However, I have a problem when applying a stylesheet to an XHTML page that is dynamically generated via PSP. Here are the directives for my directories: #------------------------------------------------ DocumentRoot "C:/Programme/Apache/Apache2/htdocs" #------------------------------------------------ <Directory /> Options FollowSymLinks AllowOverride None </Directory> #------------------------------------------------ <Directory "C:/Programme/Apache/Apache2/htdocs"> Options Indexes FollowSymLinks Multiviews ExecCGI AllowOverride None Order allow,deny Allow from all </Directory> #------------------------------------------------ <Directory "C:/Programme/Apache/Apache2/htdocs/pypublisher"> AddHandler mod_python .py PythonHandler mod_python.publisher PythonDebug On Options Indexes FollowSymLinks Multiviews ExecCGI AllowOverride None Order allow,deny Allow from all </Directory> #------------------------------------------------ <Directory "C:/Programme/Apache/Apache2/htdocs/stylesheets"> SetHandler None </Directory> In the directory /pypublisher, I have a html file with a form. This form calls a *.py file which in turn uses the PSP module to generate the contents from an XHTML template file. The XHTML should be formatted via a CSS, but it is ignored. I browsed through the archive and found that this error is caused by to main reasons: 1. The request for the CSS file is eaten up by a handler. 2. The CSS file is not found because the URI of a dynamically generated file is not the same as that of a "static" one and thus the relative URI defined in the template points to nothing. For these reasons, I placed the stylesheets in my DocumentRoot and didn´t define a handler. But it is still not working. What am I doing wrong? The script contents are as follows: #the file with the form <html> <form action="psptest.py/go" method="POST"> <input type="submit" width="200" height="50" value="Go"/> </form> </html> #the python script psptest.py from mod_python import psp def go(req): req.content_type = 'text/html' template = psp.PSP(req,filename="template.xhtm") template.run(req.form) #the xhtml template template.xhtm <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/css" href="/standard.css"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/dtds/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>modpython Template test</title> </head> <body> Hello World! </body> </html> # Additional comment: When I copy-paste the content of the generated file into a new file, it is correctly displayed in the browser. Many thanks for your advice Piet (Mod_python 3.1.3.0, WinMe, Python 2.3.4, Apache 2.0.50) -- +++ GMX - die erste Adresse für Mail, Message, More +++ 1 GB Mailbox bereits in GMX FreeMail http://www.gmx.net/de/go/mail
|