[Web-SIG] some questions about start_response implementation
Manlio Perillo
manlio_perillo at libero.it
Mon Oct 15 18:21:01 CEST 2007
Phillip J. Eby ha scritto:
> At 05:52 PM 10/15/2007 +0200, Manlio Perillo wrote:
>> Hi.
>>
>> I'm implementing the start_response callable for Nginx mod_wsgi and I
>> have a few questions.
>>
>> 1) From the WSGI PEP it seems that an implementation is allowed to
>> *always* raise an exception when start_response is called with a not
>> null exc_info.
>>
>> Is this true?
>
> Yes - as long as it's the exc_info passed in, i.e.:
It seems that WSGI *does not* requires the application to raise the
exc_info passed.
>
> try:
> raise exc_info[0], exc_info[1], exc_info[2]
> finally:
> del exc_info
>
> (this pattern of raising prevents the possibility of a reference cycle
> passing through the current stack location, keeping lots of objects
> around longer than necessary)
Is this a concern for an implementation in C, too?
>
>
>
>> 2) What happens if an application call start_response with an incorrect
>> status line or headers?
>>
>> Should an implementation consider the function "called", so that an
>> application can call it a second time, *without* the exc_info
>> parameter?
>
> Interesting point. I think it would be compliant either way, though.
>
> (I'm skipping your third question because it doesn't matter how many
> frameworks use exc_info; if you're implementing WSGI 1.0 you have to
> support it.)
>
Well, I'm asking because in the current implementation I always raise an
exception, thus not allowing an application to "change its mind".
Its not a big problem to improve the code, but I can delay it if not
really required.
Thanks and regards Manlio Perillo
More information about the Web-SIG
mailing list