Issue #8867: Fix Tools/scripts/serve.py to work with files containing

non-ASCII content.
This commit is contained in:
Antoine Pitrou 2010-08-03 17:09:36 +00:00
parent 6b54e1f782
commit f767f08e29
2 changed files with 7 additions and 1 deletions

View file

@ -85,6 +85,12 @@ Library
- Add lfu_cache() and lru_cache() decorators to the functools module. - Add lfu_cache() and lru_cache() decorators to the functools module.
Tools/Demos
-----------
- Issue #8867: Fix ``Tools/scripts/serve.py`` to work with files containing
non-ASCII content.
What's New in Python 3.2 Alpha 1? What's New in Python 3.2 Alpha 1?
================================= =================================

View file

@ -19,7 +19,7 @@ def app(environ, respond):
if os.path.exists(fn): if os.path.exists(fn):
respond('200 OK', [('Content-Type', type)]) respond('200 OK', [('Content-Type', type)])
return util.FileWrapper(open(fn)) return util.FileWrapper(open(fn, "rb"))
else: else:
respond('404 Not Found', [('Content-Type', 'text/plain')]) respond('404 Not Found', [('Content-Type', 'text/plain')])
return ['not found'] return ['not found']