launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26288
[Merge] ~cjwatson/launchpad:py3-print-emails into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-print-emails into launchpad:master.
Commit message:
Fix uses of print_emails for Python 3
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/397941
Python 3 does quoted-printable encoding slightly differently from Python 2. These doctests don't care about that sort of detail, so compare the quoted-printable-decoded message bodies instead.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-print-emails into launchpad:master.
diff --git a/lib/lp/code/doc/codeimport.txt b/lib/lp/code/doc/codeimport.txt
index 354df5e..3ecc50d 100644
--- a/lib/lp/code/doc/codeimport.txt
+++ b/lib/lp/code/doc/codeimport.txt
@@ -258,7 +258,7 @@ created if done through the web UI, so we'll add nopriv here.
... {'review_status': CodeImportReviewStatus.REVIEWED,
... 'url': 'http://svn.example.com/project/trunk'},
... nopriv)
- >>> print_emails(group_similar=True)
+ >>> print_emails(group_similar=True, decode=True)
From: Code Import Person <import@xxxxxxxxxxx>
To: david.allouche@xxxxxxxxxxxxx, ...
Subject: Code import ~person-name-.../product.../name... status: Reviewed
@@ -268,7 +268,7 @@ created if done through the web UI, so we'll add nopriv here.
instead of:
http://svn.example.com/project
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
http://code.launchpad.test/~person.../product.../name...
You are getting this email because you are a member of the vcs-imports
@@ -284,7 +284,7 @@ created if done through the web UI, so we'll add nopriv here.
instead of:
http://svn.example.com/project
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
http://code.launchpad.test/~person.../product.../name...
You are receiving this email as you are subscribed to the branch.
diff --git a/lib/lp/registry/doc/teammembership-email-notification.txt b/lib/lp/registry/doc/teammembership-email-notification.txt
index c73533c..181afe0 100644
--- a/lib/lp/registry/doc/teammembership-email-notification.txt
+++ b/lib/lp/registry/doc/teammembership-email-notification.txt
@@ -81,7 +81,7 @@ generates a notification email only to Ubuntu Team administrators.
>>> len(stub.test_emails)
5
- >>> print_distinct_emails(include_reply_to=True)
+ >>> print_distinct_emails(include_reply_to=True, decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Alexander Limi <limi@xxxxxxxxx>,
Colin Watson <colin.watson@xxxxxxxxxxxxxxx>,
@@ -99,7 +99,7 @@ generates a notification email only to Ubuntu Team administrators.
<BLANKLINE>
http://launchpad.test/~ubuntu-team/+member/lifeless
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because you are an admin of the Ubuntu Team team.
<BLANKLINE>
@@ -131,7 +131,7 @@ job now.
>>> len(stub.test_emails)
6
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Alexander Limi <limi@xxxxxxxxx>,
Colin Watson <colin.watson@xxxxxxxxxxxxxxx>,
@@ -147,7 +147,7 @@ job now.
Proposed to Declined.
<http://launchpad.test/~ubuntu-team>
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because you are an admin of the Ubuntu Team team.
<BLANKLINE>
@@ -162,7 +162,7 @@ job now.
changed by Mark Shuttleworth (mark) from Proposed to Declined.
<http://launchpad.test/~ubuntu-team>
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because you are the affected member.
<BLANKLINE>
@@ -189,7 +189,7 @@ The same goes for approving a proposed member.
>>> len(stub.test_emails)
6
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Alexander Limi <limi@xxxxxxxxx>,
Colin Watson <colin.watson@xxxxxxxxxxxxxxx>,
@@ -207,7 +207,7 @@ The same goes for approving a proposed member.
<BLANKLINE>
Mark Shuttleworth said:
This is a nice guy; I like him
- -- =
+ --
<BLANKLINE>
You received this email because you are an admin of the Ubuntu Team team.
<BLANKLINE>
@@ -224,7 +224,7 @@ The same goes for approving a proposed member.
<BLANKLINE>
Mark Shuttleworth said:
This is a nice guy; I like him
- -- =
+ --
<BLANKLINE>
You received this email because you are the affected member.
<BLANKLINE>
@@ -239,7 +239,7 @@ The same for deactivating a membership.
>>> len(stub.test_emails)
6
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Alexander Limi <limi@xxxxxxxxx>,
Colin Watson <colin.watson@xxxxxxxxxxxxxxx>,
@@ -254,7 +254,7 @@ The same for deactivating a membership.
(ubuntu-team) was changed by Mark Shuttleworth (mark) from Approved to
Deactivated.
<http://launchpad.test/~ubuntu-team>
- -- =
+ --
<BLANKLINE>
You received this email because you are an admin of the Ubuntu Team team.
<BLANKLINE>
@@ -268,7 +268,7 @@ The same for deactivating a membership.
The status of your membership in the team Ubuntu Team (ubuntu-team) was
changed by Mark Shuttleworth (mark) from Approved to Deactivated.
<http://launchpad.test/~ubuntu-team>
- -- =
+ --
<BLANKLINE>
You received this email because you are the affected member.
<BLANKLINE>
@@ -285,7 +285,7 @@ message sent.
>>> len(stub.test_emails)
5
- >>> print_distinct_emails(include_reply_to=True)
+ >>> print_distinct_emails(include_reply_to=True, decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Alexander Limi <limi@xxxxxxxxx>,
Colin Watson <colin.watson@xxxxxxxxxxxxxxx>,
@@ -303,7 +303,7 @@ message sent.
<BLANKLINE>
http://launchpad.test/~ubuntu-team/+member/admins
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because you are an admin of the Ubuntu Team team.
<BLANKLINE>
@@ -337,7 +337,7 @@ Now, the emails have been sent.
>>> len(stub.test_emails)
6
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Marilize Coetzee <marilize@xxxxxxx>
X-Launchpad-Message-Rationale: Member (ubuntu-team)
@@ -348,7 +348,7 @@ Now, the emails have been sent.
team).
<http://launchpad.test/~ubuntu-team>
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because you are the new member.
<BLANKLINE>
@@ -368,7 +368,7 @@ Now, the emails have been sent.
<BLANKLINE>
http://launchpad.test/~ubuntu-team/+member/marilize
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because you are an admin of the Ubuntu Team team.
<BLANKLINE>
@@ -396,7 +396,7 @@ membership will only be activated if they accept the invitation.
>>> len(stub.test_emails)
1
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Mark Shuttleworth <mark@xxxxxxxxxxx>
X-Launchpad-Message-Rationale: Admin (ubuntu-mirror-admins)
@@ -415,11 +415,10 @@ membership will only be activated if they accept the invitation.
Regards,
The Launchpad team
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because you are an admin of the Mirror
- Administrato=
- rs team.
+ Administrators team.
<BLANKLINE>
----------------------------------------
@@ -435,7 +434,7 @@ team.
>>> len(stub.test_emails)
6
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Alexander Limi <limi@xxxxxxxxx>,
Colin Watson <colin.watson@xxxxxxxxxxxxxxx>,
@@ -453,7 +452,7 @@ team.
Mark Shuttleworth said:
Of course I want to be part of ubuntu!
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because you are an admin of the Ubuntu Team team.
<BLANKLINE>
@@ -473,11 +472,10 @@ team.
Mark Shuttleworth said:
Of course I want to be part of ubuntu!
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because your team Mirror Administrators is the
- affe=
- cted member.
+ affected member.
<BLANKLINE>
----------------------------------------
@@ -500,7 +498,7 @@ Similarly, a notification is sent if the invitation is declined.
>>> len(stub.test_emails)
7
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Alexander Limi <limi@xxxxxxxxx>,
Colin Watson <colin.watson@xxxxxxxxxxxxxxx>,
@@ -518,7 +516,7 @@ Similarly, a notification is sent if the invitation is declined.
Mark Shuttleworth said:
Landscape has nothing to do with ubuntu, unfortunately.
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because you are an admin of the Ubuntu Team team.
<BLANKLINE>
@@ -537,11 +535,10 @@ Similarly, a notification is sent if the invitation is declined.
Mark Shuttleworth said:
Landscape has nothing to do with ubuntu, unfortunately.
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because your team Landscape Developers is the
- affec=
- ted member.
+ affected member.
<BLANKLINE>
----------------------------------------
@@ -556,7 +553,7 @@ passing force_team_add=True to the addMember() method.
>>> len(stub.test_emails)
5
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Foo Bar <foo.bar@xxxxxxxxxxxxx>
X-Launchpad-Message-Rationale: Member (ubuntu-team) @launchpad
@@ -564,8 +561,7 @@ passing force_team_add=True to the addMember() method.
Subject: launchpad joined ubuntu-team
...
You received this email because your team Launchpad Developers is the
- new m=
- ember.
+ new member.
<BLANKLINE>
----------------------------------------
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
@@ -582,7 +578,7 @@ passing force_team_add=True to the addMember() method.
<BLANKLINE>
http://launchpad.test/~ubuntu-team/+member/launchpad
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because you are an admin of the Ubuntu Team team.
<BLANKLINE>
@@ -625,7 +621,7 @@ ubuntu-team's admins.
>>> flush_database_updates()
>>> beta_testers_on_ubuntu_team.sendExpirationWarningEmail()
>>> run_mail_jobs()
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Launchpad Beta Testers Owner <beta-admin@xxxxxxxxxxxxx>
X-Launchpad-Message-Rationale: Member (ubuntu-team)
@@ -635,8 +631,8 @@ ubuntu-team's admins.
<BLANKLINE>
On ..., 9 days from now, the membership
of Launchpad Beta Testers (launchpad-beta-testers) (which you are the
- owner=
- of) in the Ubuntu Team (ubuntu-team) Launchpad team is due to expire.
+ owner of) in the Ubuntu Team (ubuntu-team) Launchpad team is due to
+ expire.
<http://launchpad.test/~ubuntu-team>
<BLANKLINE>
To prevent this membership from expiring, you should get in touch
@@ -652,11 +648,10 @@ ubuntu-team's admins.
<BLANKLINE>
Thanks for using Launchpad!
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because your team Launchpad Beta Testers is the
- aff=
- ected member.
+ affected member.
<BLANKLINE>
----------------------------------------
@@ -672,7 +667,7 @@ to renew their own membership.
>>> flush_database_updates()
>>> kamion_on_ubuntu_team.sendExpirationWarningEmail()
>>> run_mail_jobs()
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Colin Watson <colin.watson@xxxxxxxxxxxxxxx>
X-Launchpad-Message-Rationale: Member (ubuntu-team)
@@ -692,7 +687,7 @@ to renew their own membership.
<BLANKLINE>
Thanks for using Launchpad!
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because you are the affected member.
<BLANKLINE>
@@ -700,7 +695,7 @@ to renew their own membership.
>>> beta_testers_on_ubuntu_team.sendExpirationWarningEmail()
>>> run_mail_jobs()
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Launchpad Beta Testers Owner <beta-admin@xxxxxxxxxxxxx>
X-Launchpad-Message-Rationale: Member (ubuntu-team)
@@ -710,8 +705,8 @@ to renew their own membership.
<BLANKLINE>
On ..., 9 days from now, the membership
of Launchpad Beta Testers (launchpad-beta-testers) (which you are the
- owner=
- of) in the Ubuntu Team (ubuntu-team) Launchpad team is due to expire.
+ owner of) in the Ubuntu Team (ubuntu-team) Launchpad team is due to
+ expire.
<http://launchpad.test/~ubuntu-team>
<BLANKLINE>
If you want, you can renew this membership at
@@ -722,11 +717,10 @@ to renew their own membership.
<BLANKLINE>
Thanks for using Launchpad!
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because your team Launchpad Beta Testers is the
- aff=
- ected member.
+ affected member.
<BLANKLINE>
----------------------------------------
@@ -746,7 +740,7 @@ their membership page, where they can extend it.
>>> flush_database_updates()
>>> sampleperson_on_landscape.sendExpirationWarningEmail()
>>> run_mail_jobs()
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Landscape Developers <noreply@xxxxxxxxxxxxx>
To: Sample Person <test@xxxxxxxxxxxxx>
X-Launchpad-Message-Rationale: Member (landscape-developers)
@@ -755,8 +749,7 @@ their membership page, where they can extend it.
<BLANKLINE>
On ..., 9 days from now, your membership
in the Landscape Developers (landscape-developers) Launchpad team is due
- to=
- expire.
+ to expire.
<http://launchpad.test/~landscape-developers>
<BLANKLINE>
To stay a member of this team you should extend your membership at
@@ -767,7 +760,7 @@ their membership page, where they can extend it.
<BLANKLINE>
Thanks for using Launchpad!
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because you are the affected member.
<BLANKLINE>
@@ -807,7 +800,7 @@ notification is sent to all team admins.
>>> len(stub.test_emails)
1
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Mirror Administrators <noreply@xxxxxxxxxxxxx>
To: Mark Shuttleworth <mark@xxxxxxxxxxx>
X-Launchpad-Message-Rationale: Admin (ubuntu-mirror-admins)
@@ -821,11 +814,10 @@ notification is sent to all team admins.
Regards,
The Launchpad team
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because you are an admin of the Mirror
- Administrato=
- rs team.
+ Administrators team.
<BLANKLINE>
----------------------------------------
@@ -860,7 +852,7 @@ email notification.
>>> len(stub.test_emails)
6
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Alexander Limi <limi@xxxxxxxxx>,
Colin Watson <colin.watson@xxxxxxxxxxxxxxx>,
@@ -876,7 +868,7 @@ email notification.
Administrator.
<http://launchpad.test/~ubuntu-team>
<BLANKLINE>
- -- =
+ --
You received this email because you are an admin of the Ubuntu Team team.
<BLANKLINE>
----------------------------------------
@@ -890,7 +882,7 @@ email notification.
changed by Mark Shuttleworth (mark) from Approved to Administrator.
<http://launchpad.test/~ubuntu-team>
<BLANKLINE>
- -- =
+ --
You received this email because you are the affected member.
<BLANKLINE>
----------------------------------------
@@ -907,7 +899,7 @@ will only be sent to the team administrators.
>>> len(stub.test_emails)
5
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Alexander Limi <limi@xxxxxxxxx>,
Celso Providelo <celso.providelo@xxxxxxxxxxxxx>,
@@ -923,7 +915,7 @@ will only be sent to the team administrators.
Approved.
<http://launchpad.test/~ubuntu-team>
<BLANKLINE>
- -- =
+ --
You received this email because you are an admin of the Ubuntu Team team.
<BLANKLINE>
----------------------------------------
@@ -942,7 +934,7 @@ wouldn't make sense to the members of the team reading it.
>>> len(stub.test_emails)
6
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
To: Alexander Limi <limi@xxxxxxxxx>,
Celso Providelo <celso.providelo@xxxxxxxxxxxxx>,
@@ -957,7 +949,7 @@ wouldn't make sense to the members of the team reading it.
(mark) from Approved to Deactivated.
<http://launchpad.test/~ubuntu-team>
<BLANKLINE>
- -- =
+ --
You received this email because you are an admin of the Ubuntu Team team.
----------------------------------------
From: Ubuntu Team <noreply@xxxxxxxxxxxxx>
@@ -972,10 +964,9 @@ wouldn't make sense to the members of the team reading it.
(mark) from Approved to Deactivated.
<http://launchpad.test/~ubuntu-team>
<BLANKLINE>
- -- =
+ --
You received this email because your team Mirror Administrators is the
- affe=
- cted member.
+ affected member.
----------------------------------------
Deactivating memberships can also be done silently (no email
@@ -1040,7 +1031,7 @@ notification email contain subscription information.
... name='team-member', email='team-member@xxxxxxxxxxx')
>>> ignored = team_one.addMember(member, owner)
>>> run_mail_jobs()
- >>> print_distinct_emails()
+ >>> print_distinct_emails(decode=True)
From: Team One ...
To: Team-member <team-member...>
X-Launchpad-Message-Rationale: Member (team-one)
@@ -1054,7 +1045,7 @@ notification email contain subscription information.
to update your Mailing List Subscription preferences.
<http://launchpad.test/~/+editmailinglists>
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because you are the new member.
<BLANKLINE>
@@ -1067,7 +1058,7 @@ emails contain subscription information.
... name='team-two', email='team-two@xxxxxxxxxxx', owner=owner)
>>> ignored = team_one.addMember(team_two, owner, force_team_add=True)
>>> run_mail_jobs()
- >>> print_distinct_emails(include_for=True)
+ >>> print_distinct_emails(include_for=True, decode=True)
From: Team One ...
To: Team Two <team-two...>
X-Launchpad-Message-Rationale: Member (team-one) @team-two
@@ -1083,7 +1074,7 @@ emails contain subscription information.
to update your Mailing List Subscription preferences.
<http://launchpad.test/~/+editmailinglists>
<BLANKLINE>
- -- =
+ --
<BLANKLINE>
You received this email because your team Team Two is the new member.
<BLANKLINE>
diff --git a/lib/lp/testing/mail_helpers.py b/lib/lp/testing/mail_helpers.py
index 1bed4dc..36e18f2 100644
--- a/lib/lp/testing/mail_helpers.py
+++ b/lib/lp/testing/mail_helpers.py
@@ -96,7 +96,7 @@ def print_emails(include_reply_to=False, group_similar=False,
body = message.get_payload(decode=decode)
if group_similar:
# Strip the first line as it's different for each recipient.
- body = body[body.find('\n') + 1:]
+ body = body[body.find(b'\n' if decode else '\n') + 1:]
if body in distinct_bodies and group_similar:
message, existing_recipients = distinct_bodies[body]
distinct_bodies[body] = (
@@ -125,13 +125,15 @@ def print_emails(include_reply_to=False, group_similar=False,
def print_distinct_emails(include_reply_to=False, include_rationale=True,
- include_for=False, include_notification_type=True):
+ include_for=False, include_notification_type=True,
+ decode=False):
"""A convenient shortcut for `print_emails`(group_similar=True)."""
return print_emails(group_similar=True,
include_reply_to=include_reply_to,
include_rationale=include_rationale,
include_for=include_for,
- include_notification_type=include_notification_type)
+ include_notification_type=include_notification_type,
+ decode=decode)
def run_mail_jobs():
diff --git a/lib/lp/translations/doc/poexport-request-productseries.txt b/lib/lp/translations/doc/poexport-request-productseries.txt
index 53303a2..9638fc9 100644
--- a/lib/lp/translations/doc/poexport-request-productseries.txt
+++ b/lib/lp/translations/doc/poexport-request-productseries.txt
@@ -50,7 +50,7 @@ The user receives a confirmation email.
>>> test_emails = pop_notifications()
>>> len(test_emails)
1
- >>> print_emails(notifications=test_emails)
+ >>> print_emails(notifications=test_emails, decode=True)
From: ...
Subject: Launchpad translation download: Evolution trunk
Hello ...,
@@ -66,7 +66,7 @@ The user receives a confirmation email.
<BLANKLINE>
http://translations.launchpad.test/evolution/trunk/+export
<BLANKLINE>
- -- =
+ --
Automatic message from Launchpad.net.
----------------------------------------
diff --git a/lib/lp/translations/doc/poexport-request.txt b/lib/lp/translations/doc/poexport-request.txt
index fe46f0f..a18e196 100644
--- a/lib/lp/translations/doc/poexport-request.txt
+++ b/lib/lp/translations/doc/poexport-request.txt
@@ -52,7 +52,7 @@ The user receives a confirmation email.
>>> emails = pop_notifications()
>>> len(emails)
1
- >>> print_emails(notifications=emails)
+ >>> print_emails(notifications=emails, decode=True)
From: ...
To: downloader@xxxxxxxxxxx
Subject: Launchpad translation download: Ubuntu Hoary pmount -
@@ -70,7 +70,7 @@ The user receives a confirmation email.
<BLANKLINE>
http://translations.launchpad.../hoary/+source/pmount/+pots/p...
<BLANKLINE>
- -- =
+ --
Automatic message from Launchpad.net.
----------------------------------------