Very simple WSGI question

M

Matthew Wilson

I want to write some middleware to notice when the inner app returns a
500 status code. I'm sure there are already sophisticated loggers that
do this sort of thing, but I'm using this as a learning exercise.

Right now, I wrapped the start_response callable. So when the WSGI
application calls the start response callable, I look at the first arg
passed in and do my test.

What's the right way to do this?

Matt
 
M

Manlio Perillo

Il Mon, 17 Nov 2008 01:35:19 +0000, Matthew Wilson ha scritto:
I want to write some middleware to notice when the inner app returns a
500 status code. I'm sure there are already sophisticated loggers that
do this sort of thing, but I'm using this as a learning exercise.

Right now, I wrapped the start_response callable. So when the WSGI
application calls the start response callable, I look at the first arg
passed in and do my test.

What's the right way to do this?

Your method is correct.

As a more elaborated example:
http://hg.mperillo.ath.cx/wsgix/file/tip/wsgix/contrib/error_page.py

This middleware enables the rendering of custom pages for HTTP error
responses.



Regards Manlio Perillo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top