durusmail: quixote-users: Re: Medusa producers
Medusa producers
2003-08-21
Re: Medusa producers
2003-08-21
2003-08-21
2003-08-21
2003-08-21
2003-08-22
2003-08-22
2003-08-22
2003-08-22
2003-08-22
2003-08-22
response streams [Was: Medusa producers]
response streams
2003-08-27
Re: response streams [Was: Medusa producers]
2003-08-28
Re: Medusa producers
Graham Fawcett
2003-08-22
Oleg Broytmann wrote:
> On Thu, Aug 21, 2003 at 11:45:16AM -0400, Graham Fawcett wrote:
>
>>>>Personally I like the idea, but would want to make sure that it could
>>>>work correctly with all front ends
>>>
>>>  It is already impossible, because all handlers set body to str(output).
>>
>>True, but it wouldn't be too hard to add code in the other handlers
>
>
>    Who will add the code?

Well, that's a good question of course. ;-) I'd would patch
twisted_http, though whether I do it with a producer or just
''.join(map(str, iterator)) remains to be seen.


> I don't too much about Twisted and cannot patch
> twisted_http.py. Also there is SCGI, but it uses publisher.publish()
> method. What are other handlers to be patched?

The point about publisher.publish() is a good one. The more that I think
about it, the more that I would argue that *if* this were to be a
Quixote solution (rather than just a Quixote/Medusa one), I would
recommend that the iterator-handling logic should be incorporated into
the publisher, not into the handler scripts. Perhaps a handler could
notify its publisher that it's willing to accept iterators for output;
if not, the publisher would do the join and write to the "stdout" object.

(Or, a "rendering" interface could be added to Publisher, and the
handler could provide a suitable implementation that converts iterators
to producers... I seem to recall that a redesign of Publisher was in the
future plans for Quixote. Perhaps this could be factored into that design.)

I know I've played Devil's advocate here, Oleg, but I really am
interested in seeing your patch, and would likely use it, especially if
it brings a performance increase. If I had a choice, I would prefer a
Quixote/* solution, so that I can avoid painting myself into a corner if
I have to move my application to a different Web server.

It's quiet on the list these days. I am guessing that most of our
co-conspirators are on vacation. If anyone's reading, would you like to
weigh in on this idea? Would you like to see iterators/producers as a
valid Quixote response type?

Thanks,

-- Graham



reply