Jim Fulton wrote:
As WSGI is going into python 2.5, I was wondering what the general
consensus is among twisted web devs about it?  Does the WSGI model map
well into twisted's asynchronous model?


Not as well as it should IMO.  There seems to be some disdain
for asynchronous servers on the WSGI list.  I tried to
advocate on the WSGI list for better support for asynchronous
servers, especially wrt threading issues.

I think "disdain" is too strong. There's a lack of any complete proposal which would work, especially one that doesn't have Deferred or other particular bits of code as a prerequesite. There was discussion a long time ago, but it drifted off. More generally, there's no larger consensus on how to do asynchronous programming in Python, though there's obvious consensus on how to do synchronous programming (that is: with functions).

I remember some discussion about allowing an asynchronous application to return '' in the WSGI app response iterator, which would signify a yield, but I'm not sure where any ready signal would go.

Say I have a WSGI
app and I want to port it to twisted.  How easy is that?  (I know
there is a twisted wsgi module)


Trivial.

Which reminds me -- I started doing this in Paste, but got bogged down in all the setup and imports I didn't understand, and then subscribed here and never followed up. Can someone provide an example of a simple function that would look like:

def serve_with_twisted(hosts, wsgi_app, **kw):
    """Serve wsgi_app indefinitely

    hosts is a list of 'address:port', and wsgi_app is a
    WSGI application.  **kw is... whatever other interesting things
    you might want to use to configure a Twisted server
    """

Then I can lightly wrap that and people could use Twisted with their Paste configuration files.

 Do I just need to wrap some logic in deferreds?


No. You don't have to do any twisted programming at all to use the
web server via WSGI.

IMO, to get the full scalability benefits you want, you may
need to address some threading issues.  You might look at the
Zope 3 integration, which isn't as clean as it ought to me.

Is this related to the threadpool, or are you using backdoors to the underlying Twisted server to do some things in an asynchronous manner?


--
Ian Bicking  /  [EMAIL PROTECTED]  /  http://blog.ianbicking.org

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Reply via email to