mod_python and css

Bradley Hintze bradley.h at aggiemail.usu.edu
Thu Jun 24 15:10:01 EDT 2010


Hi all,

the mod_python mailing list is pretty dead so I thought I'd try asking
my question here.

I am using mod_python and am having trouble with my .py scripts that
output HTML. the HTML comes out alright but my style sheets are not
being rendered. I am sure that this has to do withe a mod handler
problem.

Here is what I have in httpd.conf:

<Directory /Library/WebServer/Documents/css>
    AddHandler mod_python .css
    PythonHandler handler::handler_css
    PythonDebug On
</Directory>


Here is what handler.py looks like:

from mod_python import apache

def _dump(req, extension):
    req.content_type = 'text/plain'
    print >> req, 'uri = %s' % req.uri
    print >> req, 'filename = %s' % req.filename
    print >> req, 'path_info = %s' % req.path_info
    print >> req, 'extension = %s' % extension
    return apache.OK

def handler(req):
    return _dump(req, '')

def handler_css(req):
    return _dump(req, '.css')


Any ideas on what I'm doing wrong?

-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799



More information about the Python-list mailing list