[SPAM] Re: [mod_python] when to use PSP handler, when to use Publisher handler

Jorey Bump list at joreybump.com
Tue Dec 30 15:05:36 EST 2008


David Jackson wrote, at 12/30/2008 11:15 AM:
> 2 things i wanted to find out more about :
>  
> 1) Graham, i took your advice "By using AddHandler for both so that
> files with different extensions
> can exist in same directory and be processed appropriately."
> 
> I then "only enabled mod_python.publisher" and from inside of
> publisher functions access to PSP class directly to render pages you
> supply references to and return that as result.
> *current httpd.conf config is*
> /<Directory "C:/www/pybin">
>    AllowOverride None
>     Options None
>     Order allow,deny
>     Allow from all
>  _AddHandler mod_python .py_/
> /  _AddHandler mod_python .psp_
>  PythonHandler mod_python.publisher
>         PythonDebug On  
> </Directory>/
> // 
> // 
> *contents of test2.psp:*
> /from mod_python import  PSP/
> /<%
> for n in range(10):
>      a= "testing" + str(n)
>      req.write(a)
> %>/
>  
> *error on page test2.psp shows :*
> /   <%/
> /    ^/
> /SyntaxError: invalid syntax/

You can assign different handlers to different extensions like this:

  AddHandler mod_python .py .psp
  PythonHandler mod_python.publisher | .py
  PythonHandler mod_python.psp | .psp

Note that this allows you to use PSP and Publisher as they are intended
to be used, depending on the file extension. IOW, You cannot put PSP
code in Publisher files and expect it to work.



More information about the Mod_python mailing list