classification
Title: Python runtime name hardcoded in wsgiref.simple_server
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pje Nosy List: dstanek, eric.araujo, groodt, orsenthil, pje, terry.reedy, thijs
Priority: normal Keywords: easy

Created on 2009-05-04 23:11 by thijs, last changed 2012-07-08 08:11 by eric.araujo. This issue is now closed.

Files
File name Uploaded Description Edit
wsgiref.patch thijs, 2009-09-27 16:06
Messages (8)
msg87190 - (view) Author: Thijs Triemstra (thijs) Date: 2009-05-04 23:10
While testing the following script on Jython 2.5b4 I noticed it returned 
SERVER_SOFTWARE = 'WSGIServer/0.1 Python/2.5b4+' instead of the expected 
'WSGIServer/0.1 Jython/2.5b4+'. This is because the word 'Python' is 
hardcoded in simple_server.py; "sys_version = "Python/" + 
sys.version.split()[0]". I suggest using the real name of the runtime 
instead of hardcoding it.

from wsgiref.simple_server import make_server, demo_app

httpd = make_server('', 8000, demo_app)
print "Serving HTTP on port 8000..."

# Respond to requests until process is killed
httpd.serve_forever()

# Alternative: serve one request, then exit
httpd.handle_request()
msg93177 - (view) Author: Thijs Triemstra (thijs) Date: 2009-09-27 16:06
Here's a patch that uses platform.python_implementation instead, 
producing:

>>> from wsgiref import simple_server
>>> simple_server.software_version
'WSGIServer/0.1 CPython/2.7a0'
>>> 

This will become relevant when Jython and IronPython start using these 
modules.
msg112708 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-08-03 22:21
In the absence of doc claiming the requested behavior, this is a feature request. In principle, it seems sensible, but I do not use the module. Support from more than one person, perhaps from python-list or web-sig list (not sure of name) would be good.

Aside from that, patch replaces 'Python' with platform.python_implementation(). For me, that is 'CPython'. Some might prefer the binary 'python' (or whatever), so I am not this is the right replacement.
msg164862 - (view) Author: Greg Roodt (groodt) * Date: 2012-07-07 14:47
Bumping as part of bug scrub at EuroPython. Patch seems sensible to me. Obvious options to me are to either accept patch, close bug or write docs. Bug has not seen activity in years, so can probably be closed.
msg164919 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-07-07 18:37
Phillip, this is a trivial wsgiref patch. Do you have any opinion?
msg164942 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2012-07-07 21:33
I have fixed this in the changeset 34e705fa4da4.

SERVER_SOFTWARE term can be made more specific to note the implementation as various suggestions say. I personally think, it is worthy to make change in 3.3 itself as its been open from a long time and it is strictly not a feature as such.
msg164947 - (view) Author: PJ Eby (pje) * (Python committer) Date: 2012-07-07 21:58
On Sat, Jul 7, 2012 at 2:37 PM, Terry J. Reedy wrote:

> Phillip, this is a trivial wsgiref patch. Do you have any opinion?
>

Nope.
msg164972 - (view) Author: √Čric Araujo (eric.araujo) * (Python committer) Date: 2012-07-08 08:11
You need to indent the block after the versionchanged directive.  Also, I believe only bug fixes should go into 3.3 now that we are in beta.
History
Date User Action Args
2012-07-08 08:11:20eric.araujosetnosy: + eric.araujo
messages: + msg164972
2012-07-07 23:33:56orsenthilsetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.3, - Python 3.4
2012-07-07 21:58:21pjesetmessages: + msg164947
2012-07-07 21:33:20orsenthilsetnosy: + orsenthil
messages: + msg164942
2012-07-07 18:37:10terry.reedysetmessages: + msg164919
versions: + Python 3.4, - Python 3.2
2012-07-07 14:47:56groodtsetnosy: + groodt
messages: + msg164862
2010-08-03 22:33:47dstaneksetnosy: + dstanek
2010-08-03 22:21:26terry.reedysettype: behavior -> enhancement
versions: + Python 3.2, - Python 2.5
keywords: + easy, - patch
nosy: + terry.reedy

messages: + msg112708
stage: patch review
2009-09-27 16:06:36thijssetfiles: + wsgiref.patch
keywords: + patch
messages: + msg93177
2009-05-04 23:15:15benjamin.petersonsetassignee: pje

nosy: + pje
2009-05-04 23:11:02thijscreate