]> granicus.if.org Git - python/commitdiff
Fix 5931 - Python runtime hardcoded in wsgiref.simple_server - Now it specifies an...
authorSenthil Kumaran <senthil@uthcode.com>
Sat, 7 Jul 2012 21:29:58 +0000 (14:29 -0700)
committerSenthil Kumaran <senthil@uthcode.com>
Sat, 7 Jul 2012 21:29:58 +0000 (14:29 -0700)
Doc/library/wsgiref.rst
Lib/test/test_wsgiref.py
Lib/wsgiref/simple_server.py
Misc/NEWS

index 1fd345145c3592c37ac6953f0fc381c74f8c2a3b..531f4e4759bc9bac6945668bf9947e212696066b 100644 (file)
@@ -609,6 +609,11 @@ input, output, and error streams.
       as :class:`BaseCGIHandler` and :class:`CGIHandler`) that are not HTTP origin
       servers.
 
+      .. versionchanged:: 3.3
+
+      The term "Python" is replaced with implementation specific term like
+      "CPython", "Jython" etc.
+
 
    .. method:: BaseHandler.get_scheme()
 
index a08f66b7b476b36d07de2cc68a14f9095dbae882..398c53a96ee2a287ecb6119f3a030ca16869acaf 100644 (file)
@@ -9,6 +9,8 @@ from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, demo_app
 from wsgiref.simple_server import make_server
 from io import StringIO, BytesIO, BufferedReader
 from socketserver import BaseServer
+from platform import python_implementation
+
 import os
 import re
 import sys
@@ -129,9 +131,11 @@ def compare_generic_iter(make_it,match):
 class IntegrationTests(TestCase):
 
     def check_hello(self, out, has_length=True):
+        pyver = (python_implementation() + "/" +
+                sys.version.split()[0])
         self.assertEqual(out,
             ("HTTP/1.0 200 OK\r\n"
-            "Server: WSGIServer/0.2 Python/"+sys.version.split()[0]+"\r\n"
+            "Server: WSGIServer/0.2 " + pyver +"\r\n"
             "Content-Type: text/plain\r\n"
             "Date: Mon, 05 Jun 2006 18:49:54 GMT\r\n" +
             (has_length and  "Content-Length: 13\r\n" or "") +
@@ -185,9 +189,11 @@ class IntegrationTests(TestCase):
         out, err = run_amock(validator(app))
         self.assertTrue(err.endswith('"GET / HTTP/1.0" 200 4\n'))
         ver = sys.version.split()[0].encode('ascii')
+        py  = python_implementation().encode('ascii')
+        pyver = py + b"/" + ver
         self.assertEqual(
                 b"HTTP/1.0 200 OK\r\n"
-                b"Server: WSGIServer/0.2 Python/" + ver + b"\r\n"
+                b"Server: WSGIServer/0.2 "+ pyver + b"\r\n"
                 b"Content-Type: text/plain; charset=utf-8\r\n"
                 b"Date: Wed, 24 Dec 2008 13:29:32 GMT\r\n"
                 b"\r\n"
index af82f953c5329923bfd212f41f418add5af8b992..a6015fb5ef87f79f83abde50dc6652f94269c0f4 100644 (file)
@@ -14,13 +14,14 @@ from http.server import BaseHTTPRequestHandler, HTTPServer
 import sys
 import urllib.parse
 from wsgiref.handlers import SimpleHandler
+from platform import python_implementation
 
 __version__ = "0.2"
 __all__ = ['WSGIServer', 'WSGIRequestHandler', 'demo_app', 'make_server']
 
 
 server_version = "WSGIServer/" + __version__
-sys_version = "Python/" + sys.version.split()[0]
+sys_version = python_implementation() + "/" + sys.version.split()[0]
 software_version = server_version + ' ' + sys_version
 
 
index aeca714fb46aaf187243c1a165faf1dd06521058..0e43c5f05525fe02aadadbbb9a1c90d33b1dea7a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -23,6 +23,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #5931: wsgiref environ variable SERVER_SOFTWARE will specify an
+  implementation specific term like Cpython, Jython instead of generic "Python"
+
 - Issue #13248: Remove obsolete argument "max_buffer_size" of BufferedWriter
   and BufferedRWPair, from the io module.