On Mon, Mar 30, 2009 at 18:46, Eric Larson <[email protected]> wrote:
> Seeing as this tuple idea is low hanging fruit, I went ahead and
> created a small bit of middleware for making the conversion.
>
> http://bitbucket.org/elarson/pack/wiki/Home
>
> Hope it helps!
If I'm not missing some quirk about some older Python version, it can
be done simpler:
def wsgi2to1(app):
"""
Adapts WSGI-2 app to WSGI-1.0 interface
"""
def wrapped(env, sr):
status, headers, body = app(env)
sr(status, headers)
return body
#@@ peak.util.decorators.rewrap
return wrapped
# this implements the new interface
def hello_app(env):
return ('200 OK', [('Content-Type', 'text/plain')], ['hello world'])
# this one conforms to the old one
hello_app_1 = wsgi2to1(hello_app)
_______________________________________________
Web-SIG mailing list
[email protected]
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe:
http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com