changeset 22:a60cf57d6628 tip

hopefully fix unicode issue
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 29 Aug 2011 22:54:21 -0700
parents 183224756ded
children
files uploader/handlers.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/uploader/handlers.py
+++ b/uploader/handlers.py
@@ -38,17 +38,17 @@ class Get(Handler):
         form = "<html><body>"
         if 'uploaded' in self.request.GET:
             form += '<div>%s uploaded successfully</div>' % self.request.GET['uploaded']
         form += self.form
         if self.app.display_contents:
             contents = os.listdir(self.app.directory)
             if contents:
                 contents.sort()
-                form += '<div><i>Currently uploaded:<ul><li>' + '</li><li>'.join(contents) + '</li></ul></i></div>'
+                form += '<div><i>Currently uploaded:<ul><li>' + '</li><li>'.join([i.decode('utf-8', 'ignore') for i in contents]) + '</li></ul></i></div>'
             else:
                 form += '<div><i>No files in upload directory</i></div>'
             log_file = self.app.log_file
             if log_file and os.path.exists(log_file):
                 log_contents = ''.join(reversed(file(log_file).readlines()))
                 form += '<div>Upload log:<pre>%s</pre></div>' % log_contents
         form += '</body></html>'
         return Response(content_type='text/html', body=form)