wsgi plugins: mod_wsgi expects bytes as an output

python3-mod_wsgi expects that the application() method returns
bytes otherwise it breaks.

https://pagure.io/freeipa/issue/4985

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Stanislav Laznicka 2017-06-27 13:22:00 +02:00 committed by Martin Basti
parent 1a35a2e213
commit db4d0998fd
3 changed files with 8 additions and 6 deletions

View File

@ -66,6 +66,7 @@ env:
TEST_RUNNER_CONFIG=".test_runner_config_py3_temp.yaml"
TESTS_TO_RUN="test_cmdline
test_ipalib
test_ipaserver/test_changepw.py
test_pkcs10
test_xmlrpc/test_location_plugin.py
test_xmlrpc/test_nesting.py
@ -98,7 +99,6 @@ env:
# test_ipapython/test_kerberos.py
# test_ipapython/test_ssh.py
# test_ipaserver/httptest.py
# test_ipaserver/test_changepw.py
# test_ipaserver/test_dnssec.py
# test_ipaserver/test_install/test_adtrustinstance.py
# test_ipaserver/test_install/test_service.py

View File

@ -34,10 +34,12 @@ def get_plugin_index():
index = 'define([],function(){return['
index += ','.join("'"+x+"'" for x in dirs)
index += '];});'
return index
return index.encode('utf-8')
def get_failed():
return 'define([],function(){return[];});/*error occured: serving default */'
return (
b'define([],function(){return[];});/*error occured: serving default */'
)
def application(environ, start_response):
try:

View File

@ -650,7 +650,7 @@ class KerberosSession(HTTP_Status):
headers.append(('IPASESSION', session_cookie))
start_response(HTTP_STATUS_SUCCESS, headers)
return ['']
return [b'']
class KerberosWSGIExecutioner(WSGIExecutioner, KerberosSession):
@ -1090,7 +1090,7 @@ class change_password(Backend, HTTP_Status):
start_response(status, response_headers)
output = _success_template % dict(title=str(title),
message=str(message))
return [output]
return [output.encode('utf-8')]
class sync_token(Backend, HTTP_Status):
content_type = 'text/plain'
@ -1188,7 +1188,7 @@ class sync_token(Backend, HTTP_Status):
start_response(status, response_headers)
output = _success_template % dict(title=str(title),
message=str(message))
return [output]
return [output.encode('utf-8')]
class xmlserver_session(xmlserver, KerberosSession):
"""