Skip to content

Commit 23cb0ad

Browse files
committed
Make example sp compatible with python3
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent 65f4acf commit 23cb0ad

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

example/sp-wsgi/sp.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,17 @@ def main(environ, start_response, sp):
697697
return sso.do()
698698

699699
body = dict_to_table(user.data)
700-
authn_stmt = cgi.escape(user.authn_statement)
701-
body.append("<br><pre>" + authn_stmt + "</pre>")
702-
body.append('<br><a href="/logout">logout</a>')
700+
body.append(
701+
"<br><pre>{authn_stmt}</pre>".format(
702+
authn_stmt=cgi.escape(user.authn_statement)
703+
)
704+
)
705+
body.append("<br><a href='/logout'>logout</a>")
706+
707+
body = [
708+
item if not isinstance(item, six.binary_type) else item.encode("utf-8")
709+
for item in body
710+
]
703711

704712
resp = Response(body)
705713
return resp(environ, start_response)

0 commit comments

Comments
 (0)