[Zope-dev] Zope 2 WSGI investigation

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


Hi,

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

Pros:

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

Cons:

* Requires repoze.tm2 and repoze.rety
* Does not properly emit publication events - possible patch in
https://gist.github.com/1548061
* 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

Pros:

* 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

Cons:

* 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
registration)
* 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

Pros:

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

Cons:

* 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
http://bugs.repoze.org/issue181
* Does not do error handling or exception views
* Problems with file resources (does not properly traverse to
browserDefault() result) -- possible patch in
http://bugs.repoze.org/issue64
* 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

Thoughts?
Martin


More information about the Zope-Dev mailing list