1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-09 22:38:19 +02:00

Modernize syntax, drop Python EOL, drop drop Django<1.11, upgrade TravisCI config to v1, add Python 3.8 & Django 3.x

This commit is contained in:
Adam Dobrawy 2019-10-15 05:31:13 +02:00
parent f9b0a27e5f
commit 2b2b7d6392
43 changed files with 228 additions and 349 deletions

View file

@ -3,8 +3,6 @@ import email.header
import logging
import os
import six
from django.conf import settings
@ -75,11 +73,8 @@ def get_settings():
def convert_header_to_unicode(header):
default_charset = get_settings()['default_charset']
if six.PY2 and isinstance(header, six.text_type):
return header
def _decode(value, encoding):
if isinstance(value, six.text_type):
if isinstance(value, str):
return value
if not encoding or encoding == 'unknown-8bit':
encoding = default_charset
@ -106,7 +101,7 @@ def get_body_from_message(message, maintype, subtype):
"""
Fetchs the body message matching main/sub content type.
"""
body = six.text_type('')
body = ''
for part in message.walk():
if part.get('content-disposition', '').startswith('attachment;'):
continue