Review Board

beta

this is the summary

Updated 5 months ago

Jay Buffington Reviewers
1723823, 1728212 jaybuff
None Review Board SVN
this is a description

 

Diff revision 1 (Latest)

  1. /trunk/reviewboard/reviews/email.py: 3 changes [ 1 2 3 ]
/trunk/reviewboard/reviews/email.py
Revision 1196 New Change
1
from datetime import datetime
1
from datetime import datetime
2
2
3
from django.conf import settings
3
from django.conf import settings
4
from django.contrib.sites.models import Site
4
from django.contrib.sites.models import Site
5
from django.core.mail import EmailMessage
5
from django.core.mail import EmailMessage
6
from django.template.loader import render_to_string
6
from django.template.loader import render_to_string
7
7
8
8
9
def get_email_address_for_user(u):
9
def get_email_address_for_user(u):
10
    if not u.get_full_name():
10
    if not u.get_full_name():
11
        return u.email
11
        return u.email
12
    else:
12
    else:
13
        return u'"%s" <%s>' % (u.get_full_name(), u.email)
13
        return u'"%s" <%s>' % ( u.get_full_name(), u.email )
14
14
15
15
16
def get_email_addresses_for_group(g):
16
def get_email_addresses_for_group(g):
17
    if g.mailing_list:
17
    if g.mailing_list:
18
        if g.mailing_list.find(",") == -1:
18
        if g.mailing_list.find(",") == -1:
19
            # The mailing list field has only one e-mail address in it,
19
            # The mailing list field has only one e-mail address in it,
20
            # so we can just use that and the group's display name.
20
            # so we can just use that and the group's display name.
21
            return [u'"%s" <%s>' % (g.display_name, g.mailing_list)]
21
            return [ u'"%s" <%s>' % ( g.display_name, g.mailing_list ) ]
22
        else:
22
        else:
23
            # The mailing list field has multiple e-mail addresses in it.
23
            # The mailing list field has multiple e-mail addresses in it.
24
            # We don't know which one should have the group's display name
24
            # We don't know which one should have the group's display name
25
            # attached to it, so just return their custom list as-is.
25
            # attached to it, so just return their custom list as-is.
26
            return g.mailing_list
26
            return g.mailing_list
27
    else:
27
    else:
28
        return [get_email_address_for_user(u) for u in g.users.all()]
28
        return [ get_email_address_for_user(u) for u in g.users.all() ]
29
29
30
30
31
class SpiffyEmailMessage(EmailMessage):
31
class SpiffyEmailMessage(EmailMessage):
32
    def __init__(self, subject, body, from_email, to, in_reply_to):
32
    def __init__(self, subject, body, from_email, to, in_reply_to):
33
        EmailMessage.__init__(self, subject, body, from_email, to)
33
        EmailMessage.__init__(self, subject, body, from_email, to)
  1. /trunk/reviewboard/reviews/email.py: 3 changes [ 1 2 3 ]