[mod_python] Mod Python 3.0.4 Filter Issue

Michael C. Neel neel at mediapulse.com
Mon Feb 16 08:21:23 EST 2004

I don't know if this is fixed in the pending 3.1.3 or not, but there
seems to be a bug in 3.0.4 with directives...
With a conf like (instead of a snippet, so much is going on that could
be related I'm posting the whole server):
        ServerName beta.mysite.com
        ServerAlias *.beta.mysite.com
        DocumentRoot /home/sites/mysite.com/www_beta/htdocs
        ScriptAlias /cgi-bin /home/sites/mysite.com/www_beta/cgi-bin
        ErrorLog /home/sites/mysite.com/logs/www_beta_error_log
        TransferLog /home/sites/mysite.com/logs/www_beta_access_log
        Alias /assets /home/sites/mysite.com/assets
        ErrorDocument 401 /error.html
        ErrorDocument 403 /error.html
        ErrorDocument 404 /error.html
        ErrorDocument 500 /error.html
        <Directory /home/sites/mysite.com/www_beta>
                PythonDebug On
                PythonOption site_dir /home/sites/mysite.com/www_beta
                PythonOption domain_dir /home/sites/mysite.com
                PythonOption db_host db_server.mysite.com
                PythonOption db_name mysite_beta
                PythonOption db_user myuser
                PythonOption db_pass mypass
                PythonOption developer_email your at email.here
        <Location />
                Options None
                SetHandler python-program
                PythonHandler www
                #PythonAuthenHandler www
                AuthType Basic
                AuthName "beta.mysite.com Site Login"
                AuthGroupFile /dev/null
                require valid-user
        <Location /cgi-bin>
                SetHandler cgi-script
                PythonOutputFilter www SKIN
                AddOutputFilter SKIN cgi
                Options ExecCGI

Inside the Location /, all the Python settings are seen from the
Directory block - but the outputfilter sees none of them, and infact
errors with cannot find the www module.  If I add to the location block:
    PythonPath ['/home/sites/mysite.com/www_beta/modules']+sys.path
It will then find the www module correctly and execute as expected (the
filter just skins the output of a cgi script).  Now if I add:
    PythonOption db_host db_server.mysite.com
It will see *all* of the PythonOptions from the Directory block, just as
the Location / block does. (this is confirmed by doing a 
filter.write(str(filter.req.get_options())) in the output filter).
I'm able to use the above to work around the issue, but I need to know
wether FIlters are supposed to have their own "namespace" of
PythonOptions, or they are intended to inherit them just as a handler
would - I don't want to have to rework code for the next release =p

More information about the Mod_python mailing list