[Zope-dev] Zope2 and WSGI
Tres Seaver
tseaver at palladion.com
Tue Dec 22 20:37:28 EST 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hanno Schlichting wrote:
> Hi Tres,
>
> I've seen you started some work on Zope2 and its WSGI publisher. This
> is awesome :)
>
> How does this relate to repoze.zope2?
>
> I'd love to have Zope2 actually support WSGI out-of-the-box. It should
> probably be based on either a simplified repoze.zope2 codebase or
> simply something that gets the job done.
>
> So what's your goal with this and is there any way I can help?
After a question on the repoze list about running Zope 2.12.x behind a
WSGI server, I went to try that out. I came up with a minimal .wsgi
file to run behind mod_wsgi::
$ cat src/Zope2/utilities/skel/bin/zope2.wsgi.in
from Zope2.Startup.run import configure
from Zope2 import startup
configure('<<INSTANCE_HOME>>/etc/zope.conf')
startup()
# mod_wsgi looks for the special name 'application'.
from ZPublisher.WSGIPublisher import publish_module as application
which works, mostly, except that all the App.ImageFile stuff, as well as
anything else using IStreamIterator, doesn't. Streaming output also
doesn't work: I'm not sure what else.
I set out to fix these bugs in ZPublisher.WSGIPublisher.WSGIResponse,
and was dismayed to find it an untested hack-up of the original Publish
module, with an untested subclass of HTTPResponse, itself almost
completely test-free. So I went down the rabbit hole, and got nearly
100% coverage of HTTPResponse on my branch, along with cleaning out some
decade-old fossils.
Remaining work would be to write tests for WSGIResponse, and then tweak
it (and HTTPResponse) to make doing the Right Thing(TM) possible for
responses which are more than just a single big string.
Beyond fixing those bugs:
- - Document using Zope2 behind mod_wsgi.
- - Write a function usable as a PasteDeploy app factory, to allow
configuration of Zope2 as the endpoint of a pipeline. Document
this feature.
- - Supply a stripped-down version of WSGIPublisher, delgating the
current implementation's "full stack" behavior (error handling,
transaction / retry integration) to middleware. The guts of this
can be lifted from repoze.zope2.z2bob. Document using this lighter-
weight publisher.
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAksxdFgACgkQ+gerLs4ltQ662QCeIyoisFj3ZFwTMGqncyvHWBi5
sTMAnjIpWtTpBJ9zid3BP0n/SIhiDBd0
=Rgs4
-----END PGP SIGNATURE-----
More information about the Zope-Dev
mailing list