[Twisted-Python] Re: twisted pyblosxom

Wari Wahab wari at home.wari.org
Mon May 12 23:27:46 EDT 2003

Moshe Zadka wrote:

>I have a feeling that you're doing something strange, like using the
>CGI module from inside the same process? Twisted Web runs CGIs just
>like any other webserver does -- in a seperate process.
I know what you mean, just that there are only very few CGI calls in 
pyblosxom, and that can easily be converted to twisted if I want.

>There are a couple of classic tricks, which vary between deferred when
>there's something specific you're waiting for or reactor.callLater loops
>if you just want to break apart something big and reactor.callInThread
>when it is too hard to break it apart.
Hmm, I'll look into reactor.callInThread() first, there's one part of 
pyblosxom core that does this for loop which can get slow if there are a 
large number of entries.

>>Another kludge I did was to return a blank string at the end of render() 
>>although I did use request.write() all over.
>It was probably better to request.finish() yourself, and
>return server.NOT_DONE_YET. 
It does look wierd in the code when I do:

def render(self, request):
    request.write("hello world")
    return NOT_DONE_YET

Is this what you are saying?

>>PS: If I were to make this run on port 80, how do I make twisted change 
>>to a different user?
>The correct way is to write a -y'able file.
Hey, thanks for the help, twisted is really nice in this aspect. But one 
thing for sure, it's not easy for me to learn, but it's one of those 
things that if you know how to, then everything else seems easier :) I'm 
trying to learn more of twisted and see if it can be used for my project.

More information about the Twisted-Python mailing list