[Jython-checkins] jython: Apply Jython modifications.
frank.wierzbicki
jython-checkins at python.org
Mon Oct 10 03:28:41 CEST 2011
http://hg.python.org/jython/rev/9bf7b81d35a9
changeset: 6249:9bf7b81d35a9
user: Frank Wierzbicki <fwierzbicki at gmail.com>
date: Sun Oct 09 18:28:12 2011 -0700
summary:
Apply Jython modifications.
files:
Lib/SimpleHTTPServer.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Lib/SimpleHTTPServer.py b/Lib/SimpleHTTPServer.py
--- a/Lib/SimpleHTTPServer.py
+++ b/Lib/SimpleHTTPServer.py
@@ -11,6 +11,7 @@
__all__ = ["SimpleHTTPRequestHandler"]
import os
+import platform
import posixpath
import BaseHTTPServer
import urllib
@@ -90,7 +91,7 @@
return None
self.send_response(200)
self.send_header("Content-type", ctype)
- fs = os.fstat(f.fileno())
+ fs = os.fstat(f.fileno()) if hasattr(os, 'fstat') else os.stat(path)
self.send_header("Content-Length", str(fs[6]))
self.send_header("Last-Modified", self.date_time_string(fs.st_mtime))
self.end_headers()
@@ -132,8 +133,9 @@
length = f.tell()
f.seek(0)
self.send_response(200)
- encoding = sys.getfilesystemencoding()
- self.send_header("Content-type", "text/html; charset=%s" % encoding)
+ if not platform.python_implementaton() == "Jython":
+ encoding = sys.getfilesystemencoding()
+ self.send_header("Content-type", "text/html; charset=%s" % encoding)
self.send_header("Content-Length", str(length))
self.end_headers()
return f
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list