[Zope3-dev] PEP 333 and Zope

Jim Fulton jim at zope.com
Tue Nov 9 08:46:03 EST 2004


Eckart Hertzler wrote:
> Hallo,
> 
> I am by no means a zope server guru - far from it.
> But the WSGI specification seems to be a good thing, so I
> decided to try just how hard it would be to convert Zope3
> to a WSGI application.
 >
> It proved to be quite easy : gere is a link to a Zope3 server running
> on Phillips WSGI reference server :
> 
> http://lentix-consulting.com:8090/

The connection is refused to me.


> It is just a pre proof of concept.
> 
> I introduced a WSGI server type which starts the WSGI reference server as a zope ServerType
> and uses the HTTPPublicationRequestFactory as is.
> 
> The entire source code is as follows :

I don't really have time to look at this right now, but Yay! :)

Are you a contributor?  If so, why not check this in?
For now, given the dependence on zope.app, I sugest zope.app.wsgi.

If not, why not become one? :)

> [snip]
> from string import split, strip

The string module is deprecated.


> from StringIO import StringIO

cStringIO is faster.

> from zope.interface import implements
> from zope.publisher.publish import publish
> from zope.server.http.httpserver import HTTPServer
> from zope.server.interfaces import IHeaderOutput
> 
> from zope.app.publication.httpfactory import HTTPPublicationRequestFactory
> from zope.app.server.servertype import ServerType
> from zope.server.http.commonaccesslogger import CommonAccessLogger
> 
> from thread import start_new_thread
> 
> from wsgiref.simple_server import WSGIServer, WSGIRequestHandler
> 
> class WsgiHeaderOutput(object):
> 
>     implements(IHeaderOutput)
> 
>     def __init__(self):
>  self._headers = {}
>  self._accumulatedHeaders = []
>  self._statusString = ""
>  self._headersSent = False

Hm, this is odd. tabs?

... no time now to study this.

Great start!

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list