vio
vmilitaru at sympatico.ca
Fri Aug 16 15:58:59 EST 2002
* Mateusz Korniak <mateusz at ant.gliwice.pl> [020816 15:26]: > On Friday 16 August 2002 21:47, vio wrote: > > Same here. My handler builds dynamic pages using successive calls to > > req.write() with no problems. In fact, the only issue here might rather be > > whether it is better (as in 'less expensive') to 'assemble' the document in > > memory and send it in one swoop to the client, as opposed to sending it > > in many calls to req.write(). > > In other words, whether it's preferable to assemble a dynamic document at > > the server level, or at the client level. I would tend to believe > > the former is better, because it reduces network traffic. Though I could be > > mistaking. But mod_python definitely allows both strategies. > > > > Yes. But what in publisher handler case ? > Can you use req.write() instead of returning page ? > I get Internal server error in that case ... :( I don't quite understand your question. req.write() IS the returning page. But I think I know where the bobo is: it's the Internal server error message. Try the following: I am assuming you are using the out-of-the-box publisher. I suspect the problem is not necessarily the 'req.write(), calls, so I suggest you try the following debugging technique to find out your 'real' bug (you will have to modify the publisher.py like following): somewhere before beginning of the handler() routine, add: """ # debugging LOG file - use this instead of '_REQUEST.write()' for debugging LOG = open('/path/to/.../LOG', "a") """ then, find each line in publisher.py: """ return apache.HTTP_INTERNAL_SERVER_ERROR """ and modify it like this: """ LOG.write('line ...\n') # current line number in publisher.py LOG.flush() return apache.HTTP_INTERNAL_SERVER_ERROR """ This will help you pinpoint exactly who/what throws that Server Error message. (just read the LOG file). Then work your way from there. I bet your problem is not your req.write() calls, but something you don't even expect. Debugging mod_python scripts is tricky, because you can not always write debugging messages to the browser. My solution is to use a LOG file. Hope this helps. (It sure helped me a lot this far). Vio
|