Commit 08b2a45c authored by Jérome Perrin's avatar Jérome Perrin Committed by Arnaud Fontaine

web: py3 WIP

parent 99bac635
...@@ -271,7 +271,7 @@ def handleLinkedData(mime, data, href): ...@@ -271,7 +271,7 @@ def handleLinkedData(mime, data, href):
"mime_type": mime, "mime_type": mime,
"encode": "quoted-printable" if mime.startswith("text/") else None, "encode": "quoted-printable" if mime.startswith("text/") else None,
"add_header_list": [("Content-Location", url)], "add_header_list": [("Content-Location", url)],
"data": str(data), "data": bytes(data),
}) })
return url return url
else: else:
...@@ -336,7 +336,7 @@ def replaceFromDataUri(data_uri, replacer): ...@@ -336,7 +336,7 @@ def replaceFromDataUri(data_uri, replacer):
data = b64decode(data) data = b64decode(data)
if not is_base64: if not is_base64:
data = replacer(data) data = replacer(data)
return "%s,%s" % (header, b64encode(data) if is_base64 else data) return "%s,%s" % (header, b64encode(data).decode() if is_base64 else data)
def extractUrlSearch(url): def extractUrlSearch(url):
url = url.split("#", 1)[0].split("?", 1) url = url.split("#", 1)[0].split("?", 1)
......
...@@ -80,7 +80,7 @@ def encode_quopri(msg): ...@@ -80,7 +80,7 @@ def encode_quopri(msg):
when necessary. when necessary.
""" """
orig = msg.get_payload() orig = msg.get_payload()
encdata = quopri.encodestring(orig.encode()).replace("=\n", "=\r\n") encdata = quopri.encodestring(orig.encode()).replace(b"=\n", b"=\r\n")
msg.set_payload(encdata) msg.set_payload(encdata)
msg.add_header("Content-Transfer-Encoding", "quoted-printable") msg.add_header("Content-Transfer-Encoding", "quoted-printable")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment