[Zope-dev] Zope 2 WSGI investigation

Martin Aspeli optilude+lists at gmail.com
Sun Jan 1 19:39:39 UTC 2012


There are three known WSGI implementations of the Zope 2 publisher.
I've had a look at them and made some notes about what I think
provides the best story:

## Zope 2.13 WSGIPublisher


* Allows distributed transaction management with repoze.tm2
* Allows distributed retry with repoze.retry
* Ships with Zope
* Quite simple


* Requires repoze.tm2 and repoze.rety
* Does not properly emit publication events - possible patch in
* Does not do error handling or exception views
* Claims not to properly implement streaming (though there is some code for it)
* Probably less well tested than infrae.wsgi and repoze.zope2 (at
least there is zero documentation)

## infrae.wsgi


* Clean and well documented
* Properly emits publication events
* Supports streaming
* Supports simplified virtual hosting with X-VHM-Host
* Supports exception handling / error views
* Reportedly has significant production use


* Not 100% compatible (but close and fixable) - fix to make
plone.transformchain work is here: https://gist.github.com/1547328
* Unnecessary five.grok dependency (but easy to rewrite to use ZCML
* No support for middleware transaction and retry management, so these
can't be distributed across a WSGI pipeline
* Error logging will not support ZMI error_log and assumes single process
* Error handling is slightly different to standard publisher's
exception views, and also does not honour existing
standard_error_message etc

## repoze.zope2


* Clean and well documented
* Reimplements and simplifies the BaseRequest.traverse() code, with comments
* Supports distributed transaction management and retry


* Replicates a lot of Zope startup code
* Has now-unnecessary code to manage instances and configuration
* repoze.obob abstraction is unnecessary since nothing else uses this
* Does not emit publication events - possible patch in
* Does not do error handling or exception views
* Problems with file resources (does not properly traverse to
browserDefault() result) -- possible patch in
* Requires various middleware (repoze.tm, repoze.retry, repoze.vhm)

## Suggested approach going forward

* Integrate infrae.wsgi into Zope 2
* Remove its five.grok dependency
* Use the same exception-views protocol as ZPublisher (mainly, that
the view name is ``index.html``)
* Stop using __ 'private' variables in response.py  to make it easier
to work with
* Add some BBB support for existing error logging and error messages


More information about the Zope-Dev mailing list