[mod_python] mod_python + vampire + psp

Graham Dumpleton grahamd at dscpl.com.au
Mon Jan 17 01:50:59 EST 2005


Keerati Inochanon wrote ..
> Hi,
> 
> I am a couple-of-day old python programmer. I decided to give a shot
> at mod_python. I successfully installed mod_python, but I am still
> trying to work with vampire. I would like psp files to be able to call
> functions in other modules (ie. a .py file). Before installing
> vampire, I was able to do this by calling filename/function (eg. <form
> action="authentication/login" method="post" name="doe"> ) . If I do
> the same thing now, it will give me a 404 file not found error.
> Putting http://domain/filename/function in the location bar will not
> work either.
> 
> This is my <Directory> tag in apache
> <Directory "C:\program files\Apache Group\Apache2\htdocs\mapserver">
> 	PythonOption VampireDirectoryIndex index.html
> 	SetHandler python-program
> 	PythonHandler vampire
> 	PythonOption VampireDefaultHandlers On
>         PythonDebug On
> 	<Files ~ "^\.vampire">
> 		Order allow,deny
> 		deny from all
> 	</Files>
> </Directory>
> 
> I am using the .vampire and default-handlers.py as provided with the
> source as the default content handler. Vampire is now mapping html
> extension to psp. The psp file snippet is below:
> 
> <html>
> <form action="authentication/login" method="post" name="auth">
>   Username: <input type="text" name="username"></input><br>
>   Password: <input type="password" name="password"></input><br>
>   <input type="hidden" name="isFirst" value="False"></input>
>   <input type="submit" value="Login">
> </form>
> </html>
> 
> Any help will be much appreciated. Thank you very much!

The form is merely a POST against a URL, specifically "authentication/login".
Using Vampire, you should therefore have a file:

  authentication/login.py

In this file it would have a handler defined as:

  def handler(req,username,password,isFirst):
    ...

The method is just "handler()" in this case, as the URL being posted against
has no extension on it.

At least that is how it should work. I'll test it when I get home and post again
then.

--
Graham Dumpleton (grahamd at dscpl.com.au)


More information about the Mod_python mailing list