Attachement should be readed in binary mode ... and attached as payload (regarding docs)

This commit is contained in:
Pawel M
2016-12-13 22:39:28 +01:00
parent 8bbe3d2e55
commit e7c4131ed7
3 changed files with 439 additions and 8 deletions

View File

@ -319,7 +319,8 @@ def ticket_from_message(message, queue, logger):
if not name:
ext = mimetypes.guess_extension(part.get_content_type())
name = "part-%i%s" % (counter, ext)
files.append(SimpleUploadedFile(name, encoding.smart_bytes(part.get_payload()), part.get_content_type()))
print(name, part.get_content_type())
files.append(SimpleUploadedFile(name, part.get_payload(decode=True), part.get_content_type()))
logger.debug("Found MIME attachment %s" % name)
counter += 1