From 2d7d0fcdcaff4c7ed2b2b5c8737dd6101040f8eb Mon Sep 17 00:00:00 2001 From: pictuga Date: Sat, 4 Nov 2017 12:27:47 +0100 Subject: [PATCH] morss: fix cgi in python 3 Needs explicit [] in py3 --- morss/morss.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/morss/morss.py b/morss/morss.py index 4f6cbe5..6d28efc 100644 --- a/morss/morss.py +++ b/morss/morss.py @@ -592,23 +592,23 @@ def cgi_wrapper(environ, start_response): headers['status'] = '200 OK' headers['content-type'] = files[url] start_response(headers['status'], list(headers.items())) - return body + return [body] except IOError: headers['status'] = '404 Not found' start_response(headers['status'], list(headers.items())) - return 'Error %s' % headers['status'] + return ['Error %s' % headers['status']] # actual morss use try: - return cgi_app(environ, start_response) or [] + return [cgi_app(environ, start_response)] or [] except (KeyboardInterrupt, SystemExit): raise except Exception as e: headers = {'status': '500 Oops', 'content-type': 'text/plain'} start_response(headers['status'], list(headers.items()), sys.exc_info()) log('ERROR <%s>: %s' % (url, e.message), force=True) - return 'An error happened:\n%s' % e.message + return ['An error happened:\n%s' % e.message] def cli_app():