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

Fixes build failures on Python 3.x.

Squashed commit of the following:

commit f3a782d0b0
Author: Adam Coddington <me@adamcoddington.net>
Date:   Sat Jan 30 22:32:51 2016 -0800

    Django 1.7 does not support Python 3.5.

commit c100ccf867
Author: Adam Coddington <me@adamcoddington.net>
Date:   Sat Jan 30 22:28:09 2016 -0800

    Ensure that message_id is always stripped.

commit ee5a023da1
Author: Adam Coddington <me@adamcoddington.net>
Date:   Sat Jan 30 22:24:27 2016 -0800

    Modern python versions do not have --use-mirrors.

commit 54aa74d984
Author: Adam Coddington <me@adamcoddington.net>
Date:   Sat Jan 30 22:19:59 2016 -0800

    Turn off sudo mode for django-mailbox.
This commit is contained in:
Adam Coddington 2016-01-30 22:35:20 -08:00
parent 22f1d05464
commit 9538996dea
2 changed files with 8 additions and 5 deletions

View file

@ -26,6 +26,8 @@ matrix:
python: '3.5'
- env: DJANGO='>=1.7,<1.8'
python: '2.6'
- env: DJANGO='>=1.7,<1.8'
python: '3.5'
- env: DJANGO='>=1.8,<1.9'
python: '2.6'
- env: DJANGO='>=1.9,<1.10'
@ -35,7 +37,8 @@ matrix:
- env: DJANGO='>=1.9,<1.10'
python: '3.4'
install:
- pip install -q Django$DJANGO --use-mirrors
- pip install -q -e . --use-mirrors
- pip install -q Django$DJANGO
- pip install -q -e .
script:
- python setup.py test
sudo: false

View file

@ -367,7 +367,7 @@ class Mailbox(models.Model):
if 'subject' in message:
msg.subject = convert_header_to_unicode(message['subject'])[0:255]
if 'message-id' in message:
msg.message_id = message['message-id'][0:255]
msg.message_id = message['message-id'][0:255].strip()
if 'from' in message:
msg.from_header = convert_header_to_unicode(message['from'])
if 'to' in message:
@ -380,7 +380,7 @@ class Mailbox(models.Model):
if message['in-reply-to']:
try:
msg.in_reply_to = Message.objects.filter(
message_id=message['in-reply-to']
message_id=message['in-reply-to'].strip()
)[0]
except IndexError:
pass
@ -560,7 +560,7 @@ class Message(models.Model):
message.from_email = settings.DEFAULT_FROM_EMAIL
message.extra_headers['Message-ID'] = make_msgid()
message.extra_headers['Date'] = formatdate()
message.extra_headers['In-Reply-To'] = self.message_id
message.extra_headers['In-Reply-To'] = self.message_id.strip()
message.send()
return self.mailbox.record_outgoing_message(
email.message_from_string(