Fix Python 3 compatibility

This commit is contained in:
Guillaume Ayoub 2014-10-22 16:28:08 +02:00
parent 4795b004b0
commit c932ba230e

View File

@ -294,10 +294,12 @@ class Application(object):
else: else:
status = client.SEE_OTHER status = client.SEE_OTHER
log.LOGGER.info("/.well-known/ redirection to: %s" % redirect) log.LOGGER.info("/.well-known/ redirection to: %s" % redirect)
headers = {"Location": redirect.encode("utf8")} if sys.version_info < (3, 0):
redirect = redirect.encode(self.encoding)
headers = {"Location": redirect}
status = "%i %s" % ( status = "%i %s" % (
status, client.responses.get(status, "Unknown")) status, client.responses.get(status, "Unknown"))
start_response(status, headers.items()) start_response(status, list(headers.items()))
return [] return []
is_authenticated = auth.is_authenticated(user, password) is_authenticated = auth.is_authenticated(user, password)