New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inlined images template engine #260
Conversation
…go-post_office into attachments-allowing-MIMEBase
…/django-post_office into template-engine-for-inlined-images # Conflicts: # post_office/tests/test_html_email.py
Some unit tests fail because either Python is too old (<3.5), or Django is too old (<1.10). |
I'm ok with dropping support for Django < 1.11. Would it be troublesome to support Python 3.4 (it's supported by Django 1.11)? |
OK, then I will change this in this pull request.
No, it's very simple to backport this. Give me some time to change it. |
OK, dropped support for Django<1.10 and Python-3.3. |
@@ -0,0 +1,54 @@ | |||
from __future__ import unicode_literals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename this file to template/backends/__init__.py
and the engine to PostOffice
? This way we can refer to this engine as 'post_office.template.backends.PostOffice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can rename it to template/backends/post_office.py
if you want, but not to __init__.py
. Reason is that this name is used in the settings.py
for POST_OFFICE['TEMPLATE_ENGINE']
and therefore we need a meaningful name here.
This btw. was the main reason, to use html_email
rather than post_office
as the template's engine name, because I wanted to emphasize that it is intended for HTML email rendering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about moving this to /post_office/template/backends.py
then? Name the engine HTMLEmailEngine
or HTMLEmail
so it can be specified as 'post_office.template.backends.HTMLEmailEngine
.
The built in Jinja2 engine can be imported as django.template.backends.jinja2.Jinja2
. I think this is a better naming convention than DjangoTemplates
(it's not a template).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem are these functions: django.template.loader.get_template
, django.template.loader.select_template
and django.template.loader.render_to_string
. They all take a parameter using
, which in our case would be get_template('/path/to/message.html', using='html_email')
. Here html_email
is the name of the module in backends
. If we move it to backends.py
, one would have to call get_template('/path/to/message.html', using='backends')
– not a very good name.
As said, I have no problem using post_office
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just renamed the template engine to post_office.PostOfficeTemplates
. I would really like to keep "Templates" inside the name, because that is what Django does with its own template engine: django.template.backends.django.DjangoTemplates
.
…ngo-post_office into inlined-images-template-engine
Please answer me on the debatable review annotations, so that I can fix them as soon as possible. |
@@ -20,7 +20,7 @@ def attach_related(self, email_message): | |||
email_message.attach(attachment) | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename this file from post_office/template/backends/post_office.py
to post_office/template/backends.py
?
EDIT: never mind this comment, I didn't see your reply here: #260 (comment)
Can I expect any time soon a new release? I'm asking because some of my apps depend on django-post_office and I wanted to know, if I shall handle the project's requirements through PyPI or GitHub. |
Hi Jacob,
I’m currently out of town. I’ll try to cut a release sometime next week. Is that ok?
Thanks for putting so much effort into this release :)
Best,
Selwin
…On 9 Apr 2019 00.30 +0700, Jacob Rief ***@***.***>, wrote:
Can I expect any time soon a new release? I'm asking because some of my apps depend on django-post_office and I wanted to know, if I shall handle the project's requirements through PyPI or GitHub.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@selwin if you want, I can take over the job of releasing new versions. I already do this for other Django apps maintained by other people, for instance easy-thumbnails and django-treebeard. I then would also ensure that the Changelog is always up to date, and that version numbers are tagged correctly to the code in the repository. In the past there unfortunately have been various mismatches: #252 , #151 and #131 . |
@jrief sorry for the delay. Would be glad to have your help in coordinating releases. How do other projects usually do this? Do they just invite you as a collaborator in their respective repos? |
Yes, on GitHub you can invite someone as collaborator. Be assured that I will never merge new features without your review. |
@jrief I have added you on both Github and PyPI. Please check your inbox :). |
@selwin Thanks, I've seen and accepted. |
This is an extension of pull request #251. It allows users to create emails using inlined images.
There is a special template engine, which shall be used in combination with a special templatetag. It keeps track on the attached images and adds them as inline-attachments.