Added new fields to Message and MessageAttachment#127
Added new fields to Message and MessageAttachment#127rulzart wants to merge 1 commit intocoddingtonbear:masterfrom
Conversation
| msg.to_header = utils.convert_header_to_unicode( | ||
| message['Delivered-To'] | ||
| ) | ||
| #rulzart - Save the email date |
There was a problem hiding this comment.
I do not know if it's a good place for signature by. It can confuse. Commits are marked with authorship.
| #rulzart - added a quick way to get Cc addresses | ||
| @property | ||
| def get_cc(self): | ||
| return self.get_email_object()["Cc"] |
There was a problem hiding this comment.
I think it should be handled quietly with the lack of such information.
| Returns the message body matching content type 'text/html' with correct image src. | ||
| """ | ||
| soup = BeautifulSoup(self.html) | ||
| for attachment in self.attachments.exclude(cid__isnull=True).exclude(cid__exact=''): |
There was a problem hiding this comment.
I suggest move this filtering as QuerySet method. I think it's good to add support for prefetch filtered attachments in some way too.
| for attachment in self.attachments.exclude(cid__isnull=True).exclude(cid__exact=''): | ||
| for img in soup.findAll('img'): | ||
| if img['src'] == attachment.cid: | ||
| img['src'] = '%s%s' % (django_settings.MEDIA_URL, attachment.document) |
There was a problem hiding this comment.
Why not attachment.document.url? See Using files in models.
|
|
||
| #rulzart - added a quick way to get Cc addresses | ||
| @property | ||
| def get_cc(self): |
There was a problem hiding this comment.
get_ prefix is incoherent for other properties in model. I suggest remove get_.
| attachment.message = record | ||
| for key, value in msg.items(): | ||
| attachment[key] = value | ||
| attachment.cid = cid |
There was a problem hiding this comment.
Raises exceptions of undefinied variable if bool(msg.get('Content-ID')) == False.
|
Lack of tests. Do you need any help to prepare tests? I suggest proposes to add at least some examples of message processing to |
| @@ -1,2 +1,3 @@ | |||
| django>=1.9,<1.10 | |||
| six | |||
| beautifulsoup4 No newline at end of file | |||
There was a problem hiding this comment.
The rtd_requirements.txt consist requirements for build docs on http://django-mailbox.readthedocs.io/. If you like add new requirements to install use install_requires in /setup.py instead.
|
@rulzart , do you plan to work on it? You have not implemented my comments for a long time. |
|
I have only worked on a local copy, decided to do all the changes directly
in my project as I need much more specialization.
But I have not worked on this project for a long time, and got no plans to
continue in the near future (full time job + 6 months old daughter). I
tried to get some other Django developers involved, but they don't have the
time either.
Med venlig hilsen / Kind Regards
Jeppe Tue Ishøy
Puggaardsgade 4, 5. tv
1573 København V
40 15 09 10
2018-01-09 15:48 GMT+01:00 Adam Dobrawy <notifications@github.com>:
… @rulzart <https://github.com/rulzart> , do you plan to work on it? You
have not implemented my comments for a long time.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#127 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEVFEaPLoiPNwA8WqBYeqLkQo81DEsU6ks5tI3xJgaJpZM4LUOL_>
.
|
Message:
date (DateTimeField)
property: get_cc (gets the Cc addresses from header)
property: html_with_img (replaces cid image values with actual attachment url, requires BeautifulSoup)
MessageAttachment:
field: cid (charfield, Content-ID from attachment header)
Furthermore altered the _get_dehydrated_message to get and save the Content-ID from the message.