[Twisted-Python] Trying to figure out twisted.web

Abe Fettig abe at fettig.net
Tue Feb 18 12:55:10 EST 2003


Hi all,

This weekend I started playing around with twisted.web, and I'm really
impressed.  This is great stuff.  I'd like to port the web interface for
Hep over to twisted.web (the current version uses twisted.protocols.http
only), but I'm having trouble figuring out the best way to accomplish
what I want.

So far I've set up a server that processes .epy files using
twisted.web.script.PythonScript.  This would be fine, except that it
doesn't seem to let me do asynchronous things - I can start a deferred,
and set the callback to request.write(something), but then it never gets
called.

twisted.web.widgets looked like the logical place to go next, but then  
http://twistedmatrix.com/documents/howto/widgets says that widgets are
depriciated in favor of Woven.  But Woven is kind of a lot to get my
head around at the moment, and it looks like I'd have to rewrite all my
code to use it.  Is that really the only solution?  If so, is there an
example of a woven page that runs a deferred function and then writes
some output when it gets a callback?

Also, I'm having trouble with twisted.web.static.Registry.  All I want
to is make a set of objects available to all the pages in my site. I
don't understand how a Registry object uses interfaces, or even why its
neccessary to use interfaces at all.  Is there a way to access objects
in the registry by name?  Some sample code would helpe me here, too.

Thanks!
-- 
Abe Fettig <abe at fettig.net>





More information about the Twisted-Python mailing list