Name/email formatting tweaks, to complement [13536].
- Legacy-Id: 13540
Note: SVN reference [13536] has been migrated to Git commit 55d36e284d
This commit is contained in:
parent
55d36e284d
commit
a28940fc1e
|
@ -14,6 +14,7 @@ from ietf.group.colors import fg_group_colors, bg_group_colors
|
|||
from ietf.name.models import GroupStateName, GroupTypeName, DocTagName, GroupMilestoneStateName, RoleName
|
||||
from ietf.person.models import Email, Person
|
||||
from ietf.utils.mail import formataddr
|
||||
from ietf.utils.log import unreachable
|
||||
|
||||
|
||||
class GroupInfo(models.Model):
|
||||
|
|
|
@ -6,7 +6,6 @@ from django.template import Template, Context
|
|||
from email.utils import parseaddr
|
||||
from ietf.utils.mail import formataddr
|
||||
|
||||
|
||||
import debug # pyflakes:ignore
|
||||
|
||||
from ietf.group.models import Role
|
||||
|
@ -178,10 +177,14 @@ class Recipient(models.Model):
|
|||
return addrs
|
||||
|
||||
def gather_submission_authors(self, **kwargs):
|
||||
"""
|
||||
Returns a list of name and email, e.g.: [ 'Ano Nymous <ano@nymous.org>' ]
|
||||
Is intended for display use, not in email context.
|
||||
"""
|
||||
addrs = []
|
||||
if 'submission' in kwargs:
|
||||
submission = kwargs['submission']
|
||||
addrs.extend([ email.utils.formataddr((author["name"], author["email"])) for author in submission.authors if author.get("email")])
|
||||
addrs.extend(["%s <%s>" % (author["name"], author["email"]) for author in submission.authors if author.get("email")])
|
||||
return addrs
|
||||
|
||||
def gather_submission_group_chairs(self, **kwargs):
|
||||
|
|
|
@ -487,9 +487,9 @@ TEST_CODE_COVERAGE_EXCLUDE = [
|
|||
"ietf/settings*",
|
||||
"ietf/utils/templatetags/debug_filters.py",
|
||||
"ietf/utils/test_runner.py",
|
||||
"name/generate_fixtures.py",
|
||||
"review/import_from_review_tool.py",
|
||||
"stats/backfill_data.py",
|
||||
"ietf/name/generate_fixtures.py",
|
||||
"ietf/review/import_from_review_tool.py",
|
||||
"ietf/stats/backfill_data.py",
|
||||
]
|
||||
|
||||
# These are filename globs. They are used by test_parse_templates() and
|
||||
|
|
|
@ -5,6 +5,7 @@ import email
|
|||
import pytz
|
||||
import xml2rfc
|
||||
import tempfile
|
||||
from email.utils import formataddr
|
||||
from unidecode import unidecode
|
||||
|
||||
from django import forms
|
||||
|
@ -351,7 +352,7 @@ class SubmitterForm(NameEmailForm):
|
|||
line = self.cleaned_data["name"]
|
||||
email = self.cleaned_data.get("email")
|
||||
if email:
|
||||
line += u" <%s>" % email
|
||||
line = formataddr((line, email))
|
||||
return line
|
||||
|
||||
class ReplacesForm(forms.Form):
|
||||
|
|
Loading…
Reference in a new issue