[mod_python] Access-Handler based on a Variable

Christian Klinger cklinger at novareto.de
Mon Aug 6 04:42:03 EDT 2007


Hi mod_python Users,

i am new to mod_python so sorry for stupid questions.


I try to write an access handler for an xml-rpc connection.
The access handler should check if a key in the xml-rpc
data is correct.

Here my questions:
Is this possible with mod_python?
Has anyone an example?
How can i access the (12) of getResults in the accesshandler.


Christian

Here is my code:
--------------------------------------------------------
<VirtualHost *:80>
     ServerName dummy-host.example.com
     ServerAlias www.dummy-host.example.com

    <Proxy *>
       AuthBasicAuthoritative Off
        AddHandler mod_python .py
        PythonHandler myscript.py
        PythonAccessHandler myscript
        PythonDebug On
        PythonEnablePdb On
      </Proxy>

         RewriteEngine On
         RewriteRule ^/(.*) 
http://localhost:8080/VirtualHostBase/http/%{SERVER_NAME}:80/extraNet/VirtualHostRoot/$1 
[L,P]

</VirtualHost>


myscript.py
def accesshandler(req):
     apache.log_error("accesshandler -%s" %req)
     if key == "OK"
         return apache.OK
     return


the client:
portal = xmlrpclib.Server('http://192.168.2.23/extraNet')
print portal
print portal.getResult(12)



More information about the Mod_python mailing list