[Web-SIG] ANN: Release 0.20.0 of modjy: a WSGI gateway for jython 2.1 and J2EE.

Alan Kennedy py-web-sig at xhaus.com
Mon Oct 4 13:40:17 CEST 2004


[Alan Kennedy]
>>> Also, I would have to add a fair amount of extra code, just to ensure 
>>> that the extension APIs present the same information as the standard 
>>> WSGI interface. Which seems unnecessary, given that the WSGI 
>>> information is already there.

[Phillip J. Eby]
>> Right.  I think it's a natural first thought to say, "Oh, I'll add an 
>> extension API so you can get at the original server request", but 
>> given the purpose of WSGI, at second thought it seems rather 
>> pointless.  If the app author wanted something non-portable, he'd have 
>> written to the server's API to begin with.  

Or the author may want to reuse some existing WSGI code, and minimally 
tweak it to use a server-specific API. And could explicitly check for 
relevant server-specific extensions in different servers/gateways, e.g.

if environ.has_key('j2ee.request'):
   # Do J2EE specific processing
elif environ.has_key('mod_python.request'):
   # Do mod_python specific processing
else:
   raise UnableToProvideError()

That said, I can not currently think of situation where such might be 
necessary.

[Phillip J. Eby]
>> If it's *extra* 
>> information you're providing, just add it to environ, as long as it's 
>> not information *derived* from other data in environ.  If it's 
>> derived, offer a function to derive it, rather than data.

[Ian Bicking]
> I think Alan might be considering a situation in which there's some 
> information which he isn't aware of that's missing, and rather than have 
> the application author curse him for neutering his environment, he gives 
> the author a way to get around it all.

I couldn't have said it better myself, Ian.

[Ian Bicking]
> Maybe it would be sufficient not to provide the request or response 
> immediately in the dictionary, but require the author to do something 
> like j2ee_req = environ['modjy.request'](environ); then when they get 
> this, you could emit a warning, or if they get the request and you 
> detect that there's something weird about the environ, you return None, 
> raise an exception, log a warning, or something along those lines.

I'll do whatever is necessary to comply with the spec. If bypassing 
middleware is judged to be out-of-the-question, then I will either 
eliminate the extensions or wrap them so that they are compliant.

Regards,

Alan.


More information about the Web-SIG mailing list