[Twisted-Python] Twisted-Python Digest, Vol 90, Issue 16

Glyph Lefkowitz glyph at twistedmatrix.com
Tue Sep 20 16:29:59 EDT 2011


On Sep 20, 2011, at 3:33 PM, Jeroen van Veen wrote:

> For this websocket cms project im working on, i also run django in a wsgi container. I wonder if im using  it the right way? (https://github.com/phrearch/hwios/blob/master/services/web_ui/service.py)

Generally, yes, except for the "MainThreadWSGIResource" part.

First of all: you're taking your life in your own hands when you use a Twisted API that starts with a single underscore :-).  http://twistedmatrix.com/trac/wiki/CompatibilityPolicy

Second, _WSGIResponse _does_ run the response in a thread; your code isn't doing what it claims to be doing.  The right way to do this is not to override the WSGI layer, but to provide a fake threadpool whose 'callInThread' just calls the given callable on the main thread.

+1 for having a "plasmoids" module, by the way - does this software control a magnetically regulated plasma reaction at some point? :).

-glyph

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20110920/b6c732d2/attachment.htm 


More information about the Twisted-Python mailing list