On Fri, Sep 18, 2009 at 5:07 PM, P.J. Eby <p...@telecommunity.com> wrote: > On his blog, Graham mentioned some skepticism about skipping WSGI 1.1 and > going straight to 2.0, due to concern that people using write() would need > to make major code changes to go to WSGI 2.0.
I'm not entirely clear why this is such a big deal. Here's how I'd implement a WSGI 2 wrapper around a WSGI 1 app: def wsgi1to2(app): def new_app(environ): written = [] status_headers = [] def start_response(status, headers, exc_info=None): if exc_info is not None: raise exc_info[0], exc_info[1], exc_info[2] status_headers[:] = [status, headers] return written.append app_iter = app(environ, start_response) if not status_headers: app_iter = iter(app_iter) written.append(app_iter.next()) assert status_headers if written: app_iter = itertools.chain(written, app_iter) return status_headers[0], status_headers[1], app_iter What's wrong with this simpler approach to the conversion? -- Ian Bicking | http://blog.ianbicking.org | http://topplabs.org/civichacker _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com