[mod_python] Simple Issue, Baffling

Waitman Gobble waitman at waitman.net
Thu Jan 26 17:03:31 EST 2006



It works ok for me on apache/linux, but my config is a little different


httpd.conf


        RewriteEngine on
        RewriteCond %{REQUEST_URI} ^/xcss/(.*)$
        RewriteRule ^/xcss/(.*)$ /css.py?r=$1


            SetHandler mod_python
            PythonHandler mod_python.publisher
            PythonDebug Off
            PythonLogHandler log::logger




http://pyblog.com/test.htm

<html>
<head>
<link rel="stylesheet" href="/xcss/css.css" type="text/css">
</head>

<body>
<h1>FOO</h1>
</body>

</html>






http://pyblog.com/xcss/foo.css

body { background-color: yellow; }






http://pyblog.com/css.py


from mod_python import apache
import cgi

def index(req):

    req.content_type = "text/css"
    req.send_http_header()
    req.did_success=True
    content="body { background-color: yellow; }"
    return (content)



Waitman




David Worley wrote:
> I have Firefox set to have no cache. Despite that, I still Shift+Refresh
> when I'm testing a new app.
> 
> It's not that it's holding on to an old request, it's more that the
> server never returned content the browser recognized as CSS, or HTML.
> 
> Thanks for the suggestion, though!
> 
> ===============================
> David Worley
> Senior Front End Developer
> dworley at communityconnect.com
> =============================== 
> 
> -----Original Message-----
> From: mod_python-bounces at modpython.org
> [mailto:mod_python-bounces at modpython.org] On Behalf Of Eric Strand
> Sent: Thursday, January 26, 2006 4:42 PM
> To: mod_python at modpython.org
> Subject: Re: [mod_python] Simple Issue, Baffling
> 
> 
> Might it have to do with browser caching?  In the past I've encounter 
> similar frustration, and realized the browser was being too helpful.
> 
> 
> 
> David Worley wrote:
>> Yeah, typo. Thanks for pointing that out.
>>
>> The preprocessor is going to get a request for a .css file, find a
> .sss
>> file, process it, and return it as CSS.
>>
>> It's correct in the actual program.
>>
>> Believe me, I've combed over everything small like that. I wouldn't
> have
>> written without doing so. It seems like I've missed something in my
>> understanding of the req object, or the content_type property, or in
> the
>> way that AddHandler works.
>>
>> Any ideas?
>>
>> ===============================
>> David Worley
>> Senior Front End Developer
>> dworley at communityconnect.com
>> =============================== 
>>
>> -----Original Message-----
>> From: Waitman Gobble [mailto:waitman at waitman.net] 
>> Sent: Thursday, January 26, 2006 4:23 PM
>> To: Jim Gallacher
>> Cc: David Worley; mod_python at modpython.org
>> Subject: Re: [mod_python] Simple Issue, Baffling
>>
>> Sorry to jump in the middle of the conversation, but is
>>
>> AddHandler python-program .sss
>>
>> supposed to be
>>
>> AddHandler python-program .css
>>
>> ???
>>
>> Take care,
>>
>> Waitman
>>
>>
>>
>>
>>
>> Jim Gallacher wrote:
>>
>>> David Worley wrote:
>>>
>>>> I'm writing a CSS preprocessor. It's meant to grab a request for a
>> .css
>>
>>>> So with the following httpd.conf entry:
>>>>
>>>> <Directory /some/file/system/directory>
>>>>    AddHandler python-program .sss
>>>>    PythonHandler switch
>>>>    PythonDebug On
>>>> </Directory>
>>
>>
>> _______________________________________________
>> Mod_python mailing list
>> Mod_python at modpython.org
>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python


More information about the Mod_python mailing list