Mercurial > hg > clwapp
changeset 2:79a43cbdf584
fix unicode stuff
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 20 Dec 2011 11:34:10 -0800 |
parents | 2f45e6ae75fc |
children | 672addc0c4be |
files | clwapp/clwapp.py setup.py |
diffstat | 2 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/clwapp/clwapp.py Fri Feb 26 13:23:52 2010 -0500 +++ b/clwapp/clwapp.py Tue Dec 20 11:34:10 2011 -0800 @@ -15,6 +15,7 @@ """ +import os import subprocess import utils @@ -37,7 +38,7 @@ self.request = Request(environ) res = self.make_response(self.request.method) return res(environ, start_response) - + def make_response(self, method): return self.response_functions.get(method, self.error)() @@ -53,7 +54,8 @@ args = self.command + self.request.GET.keys() process = subprocess.Popen(args, stdout=subprocess.PIPE) output = process.communicate()[0] - title = ' '.join(args) + output = output.decode('utf-8', errors='ignore') + title = ' '.join([os.path.basename(args[0])] + args[1:]) return self.get_response("""<html><head><title>%s</title></head><body><pre> %s </pre></body></html> @@ -62,4 +64,4 @@ def error(self): """deal with non-supported methods""" return exc.HTTPMethodNotAllowed("Only %r operations are allowed" % self.response_functions.keys()) - +