[Twisted-Python] Process Producer, Request Consumer
glyph at twistedmatrix.com
Sat Nov 17 15:21:40 EST 2001
On Sat, 2001-11-17 at 13:26, Kevin Turner wrote:
> So somebody asked on the channel today, "how do I get the output of a
> system command displayed on my .epy web page?"
> Basically, the <!--#exec cmd="foo" --> type of thing, if I remember my
> Now, given the pieces that are in Twisted, it seems like this should be
> at most two lines long:
> 1) create Process
> 2) designate the web Request as a consumer of the Process.
> except that I don't know how to do #2 quite so succinctly. Can anyone
> speak on this subject?
Your answer is, unfortunately, wrong. From a .epy, the best way to do
that is just to run os.popen().read() :). Otherwise, you would be
abandoning any further output to that webpage; the Process would take
over and close it.
This is exactly the sort of situation that web.widgets was designed to
remedy. There is unfortunately no widget currently for "process
output", but there should be. Patches accepted!. (There should also be
one for "relational database query", of course).
> The moon is waxing crescent, 5.7% illuminated, 2.3 days old.
I'm practically afraid to check -- does Nethack still consider this a
"new moon"? :)
______ you are in a maze of twisted little applications, all
| |_\ remarkably consistent.
| | -- glyph lefkowitz, glyph @ twisted matrix . com
More information about the Twisted-Python