From: Bradley Hintze on
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
From: Thomas Jollans on
On 06/24/2010 09:10 PM, Bradley Hintze wrote:
> Hi all,

about your question, no idea.

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

It comes as no surprise to me that the mod_python mailing list is dead:
nobody uses mod_python anymore. For all I know, it might be broken, and
the API was (IIRC) never particularly nice.

IMHO, you should use WSGI instead: it's an interface portable across web
server boundaries, and, with mod_wsgi, it's just as high-performance on
apache as was mod_python.

>
> 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.

What does "not being rendered" mean? Do you have an exception traceback?
Can you maybe a full transcript of HTTP headers and output? (by
telnet'ing to the web server perhaps)

>
> 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?
>

From: Bradley Hintze on
I had some issues with WSGI install. It was duious at best as it
failed and seemed very unstable. Is this a trusted application?

On Thu, Jun 24, 2010 at 3:19 PM, Thomas Jollans <thomas(a)jollans.com> wrote:
> On 06/24/2010 09:10 PM, Bradley Hintze wrote:
>> Hi all,
>
> about your question, no idea.
>
>>
>> the mod_python mailing list is pretty dead so I thought I'd try asking
>> my question here.
>
> It comes as no surprise to me that the mod_python mailing list is dead:
> nobody uses mod_python anymore. For all I know, it might be broken, and
> the API was (IIRC) never particularly nice.
>
> IMHO, you should use WSGI instead: it's an interface portable across web
> server boundaries, and, with mod_wsgi, it's just as high-performance on
> apache as was mod_python.
>
>>
>> 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.
>
> What does "not being rendered" mean? Do you have an exception traceback?
> Can you maybe a full transcript of HTTP headers and output? (by
> telnet'ing to the web server perhaps)
>
>>
>> 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?
>>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



--
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799
From: John Nagle on
If you send back a content type of "text/plain", your output
will not be rendered as HTML by a browser; it will just be
displayed as plain text.

Try "text/html".

John Nagle

On 6/24/2010 12:19 PM, Thomas Jollans wrote:
> On 06/24/2010 09:10 PM, Bradley Hintze wrote:
>> Hi all,
>
> about your question, no idea.
>
>>
>> the mod_python mailing list is pretty dead so I thought I'd try asking
>> my question here.
>
> It comes as no surprise to me that the mod_python mailing list is dead:
> nobody uses mod_python anymore. For all I know, it might be broken, and
> the API was (IIRC) never particularly nice.
>
> IMHO, you should use WSGI instead: it's an interface portable across web
> server boundaries, and, with mod_wsgi, it's just as high-performance on
> apache as was mod_python.
>
>>
>> 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.
>
> What does "not being rendered" mean? Do you have an exception traceback?
> Can you maybe a full transcript of HTTP headers and output? (by
> telnet'ing to the web server perhaps)
>
>>
>> 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?
>>
>