elarson / PACK

A simple wrapper to use a returned tuple instead of using start response in WSGI. This was discussed at Pycon 2009 and was agreed upon my all the parties invovled.

Clone this repository (size: 5.2 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/elarson/pack/

PACK: Looking to WSGI 2.0

During PyCon 2009 it was discussed how to improve WSGI in order to implement the second version of the spec. One of the issues raised was the returning of a tuple instead of using a start response function to trigger returning the response to the client. Effectively, instead of doing:

1
2
start_response('200 OK', [('Content-Type', 'text/plain')])
return ['hello world']

You would return:

1
return ('200 OK', [('Content-Type', 'text/plain')], ['hello world'])

The idea is that this makes writing middleware much simpler and straightforward.

PACK is then an implementation of this change so you can use it within a web framework or existing WSGI stack and evaluate the change.


This revision is from 2009-03-30 17:38