classification
Title: Python runtime name hardcoded in wsgiref.simple_server
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.2
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: pje Nosy List: dstanek, pje, terry.reedy, thijs
Priority: normal Keywords: easy

Created on 2009-05-04 23:11 by thijs, last changed 2010-08-03 22:33 by dstanek.

Files
File name Uploaded Description Edit
wsgiref.patch thijs, 2009-09-27 16:06 review
Messages (3)
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.
History
Date User Action Args
2010-08-03 22:33:47dstaneksetnosy: + dstanek
2010-08-03 22:21:26terry.reedysetnosy: + terry.reedy
versions: + Python 3.2, - Python 2.5
messages: + msg112708

keywords: + easy, - patch
type: behavior -> enhancement
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