Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(104)

Issue 4657057: fix CCs when sending emails

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 11 months ago by steve2
Modified:
14 years, 11 months ago
Reviewers:
Andi Albrecht
CC:
gae2django_googlegroups.com
Base URL:
http://django-gae2django.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Django 1.3 introduced the cc constructor kwarg for django.core.mail.EmailMessage. CC addresses do not appear to work at all in trunk, and do appear to work with this patch. Not sure if you're trying to be compatible with Django <1.3, if so I guess an alternate patch is necessary.

Patch Set 1 #

Patch Set 2 : new version compatible with Django <1.3 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -8 lines) Patch
M gae2django/gaeapi/appengine/api/mail.py View 1 3 chunks +7 lines, -8 lines 2 comments Download

Messages

Total messages: 9
steve2
14 years, 11 months ago (2011-06-28 22:41:40 UTC) #1
Andi Albrecht
Hi Steve, thanks for your patch and reporting this issue. But I wasn't able to ...
14 years, 11 months ago (2011-06-30 07:31:20 UTC) #2
steve2
Hi Andi, Sorry, I should have been more specific. The behavior I observed was that ...
14 years, 11 months ago (2011-06-30 19:53:30 UTC) #3
Andi Albrecht
Hi Steve, thanks for the explanations! See inline reply below. Steve Howard <steve@thumbtack.com> writes: > ...
14 years, 11 months ago (2011-07-01 12:27:46 UTC) #4
Andi Albrecht
On Wed, Jun 29, 2011 at 12:41 AM, <steve@thumbtack.com> wrote: > Reviewers: Andi Albrecht, > ...
14 years, 11 months ago (2011-07-01 12:31:31 UTC) #5
steve2
On Fri, Jul 1, 2011 at 5:27 AM, Andi Albrecht <albrecht.andi@googlemail.com>wrote: > Hi Steve, > ...
14 years, 11 months ago (2011-07-01 23:58:25 UTC) #6
Andi Albrecht
http://codereview.appspot.com/4657057/diff/6001/gae2django/gaeapi/appengine/api/mail.py File gae2django/gaeapi/appengine/api/mail.py (right): http://codereview.appspot.com/4657057/diff/6001/gae2django/gaeapi/appengine/api/mail.py#newcode80 gae2django/gaeapi/appengine/api/mail.py:80: if value is not None: Why did you add ...
14 years, 11 months ago (2011-07-04 13:25:15 UTC) #7
steve2
On Mon, Jul 4, 2011 at 6:25 AM, <albrecht.andi@googlemail.com> wrote: > > http://codereview.appspot.com/**4657057/diff/6001/gae2django/** > gaeapi/appengine/api/mail.py<http://codereview.appspot.com/4657057/diff/6001/gae2django/gaeapi/appengine/api/mail.py> ...
14 years, 11 months ago (2011-07-04 21:31:34 UTC) #8
Andi Albrecht
14 years, 11 months ago (2011-07-05 04:35:10 UTC) #9
On Mon, Jul 4, 2011 at 11:31 PM, Steve Howard <steve@thumbtack.com> wrote:
> On Mon, Jul 4, 2011 at 6:25 AM, <albrecht.andi@googlemail.com> wrote:
>>
>>
>>
http://codereview.appspot.com/4657057/diff/6001/gae2django/gaeapi/appengine/a...
>> File gae2django/gaeapi/appengine/api/mail.py (right):
>>
>>
>>
http://codereview.appspot.com/4657057/diff/6001/gae2django/gaeapi/appengine/a...
>> gae2django/gaeapi/appengine/api/mail.py:80: if value is not None:
>> Why did you add this test? None values for missing fields should be ok
>> (see comment below too)
>
> Just made it more convenient to say "self.cc + self.bcc" without having to
> check for Nones.
>
>>
>>
>>
http://codereview.appspot.com/4657057/diff/6001/gae2django/gaeapi/appengine/a...
>> gae2django/gaeapi/appengine/api/mail.py:110: self.to, self.cc +
>> self.bcc, headers=headers)
>> This collapses CC and BCC into Bcc. IMO we need two paths for
>> constructing a new EmailMessage instance depending on Django version in
>> use here.
>
> But the bcc kwarg is only used by Django's EmailMessage class in the
> recipients() method, to generate the recipient list.  It's never actually
> used in any BCC-specific way, it doesn't add a Bcc: header or anything.  So
> what we're really doing here is adding the CC addresses to the recipients
> list and putting them in a Cc: header, which is the correct way to handle
> CC.  And if you look at the Django 1.3 EmailMessage class you'll see those
> are exactly the two things it does with the cc kwarg.

Agreed. The CC's are in the CC header and both CC+BCC are correctly
returned when recipients() is called. So you approach should be fine
with all current Django versions.

Thanks again for clarification and the patch. Committed as r169.

-Andi

> I agree that from the point of view of using Django's API, it's confusing.
>  The real problem is that Django's email API is lacking.  I like this
> solution because it works in Django 1.2 and Django 1.3, it has the exact
> same effect as passing the cc kwarg in Django 1.3, and it's not terribly
> confusing -- we could add a short comment explaining why we're sticking CC
> addresses into the bcc kwarg.  The only alternative I'm aware of is to
> subclass Django's EmailMessage, which sounds like a lot more work
> (from https://code.djangoproject.com/ticket/7722; I'm surprised no one in
> that thread mentioned the approach used here).
> It's a judgment call, I leave that up to you :)
> Steve
>
>>
>> http://codereview.appspot.com/4657057/
>
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b