~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/doc/mailinglist-subscriptions.txt

  • Committer: Launchpad Patch Queue Manager
  • Date: 2012-01-04 22:21:41 UTC
  • mfrom: (14617.3.4 mailinglists-use-people)
  • Revision ID: launchpad@pqm.canonical.com-20120104222141-0g1fa43d7ibeuytg
[r=sinzui][no-qa] Clean up
        MailingList(Set).get(Subscribed|Sender)Address,
        and fix them to not use EmailAddress.account.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
mailing list, are available both through the mailing list object and through
49
49
the mailing list set.
50
50
 
51
 
    >>> sorted(email.email for email in list_one.getSenderAddresses())
 
51
    >>> sorted(list_one.getSenderAddresses())
52
52
    [u'anne.person@example.com', u'aperson@example.org',
53
53
     u'bart.person@example.com', u'bperson@example.org',
54
54
     u'no-priv@canonical.com']
76
76
    >>> list_one.subscribe(anne)
77
77
    >>> transaction.commit()
78
78
 
79
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
79
    >>> sorted(list_one.getSubscribedAddresses())
80
80
    [u'anne.person@example.com']
81
81
    >>> sorted(person.displayname for person in list_one.getSubscribers())
82
82
    [u'Anne Person']
94
94
    >>> list_one.subscribe(bart, alternative_email)
95
95
    >>> transaction.commit()
96
96
 
97
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
97
    >>> sorted(list_one.getSubscribedAddresses())
98
98
    [u'anne.person@example.com', u'bperson@example.org']
99
99
    >>> sorted(person.displayname for person in list_one.getSubscribers())
100
100
    [u'Anne Person', u'Bart Person']
114
114
messages.  However, the user may post a message from any of the addresses
115
115
they've confirmed with Launchpad.
116
116
 
117
 
    >>> sorted(email.email for email in list_one.getSenderAddresses())
 
117
    >>> sorted(list_one.getSenderAddresses())
118
118
    [u'anne.person@example.com', u'aperson@example.org',
119
119
     u'bart.person@example.com', u'bperson@example.org',
120
120
     u'no-priv@canonical.com']
129
129
    >>> alternative.email
130
130
    u'anne.x.person@example.net'
131
131
 
132
 
    >>> sorted(email.email for email in list_one.getSenderAddresses())
 
132
    >>> sorted(list_one.getSenderAddresses())
133
133
    [u'anne.person@example.com', u'aperson@example.org',
134
134
     u'bart.person@example.com', u'bperson@example.org',
135
135
     u'no-priv@canonical.com']
140
140
    >>> alternative.status = EmailAddressStatus.VALIDATED
141
141
    >>> transaction.commit()
142
142
 
143
 
    >>> sorted(email.email for email in list_one.getSenderAddresses())
 
143
    >>> sorted(list_one.getSenderAddresses())
144
144
    [u'anne.person@example.com', u'anne.x.person@example.net',
145
145
     u'aperson@example.org',
146
146
     u'bart.person@example.com', u'bperson@example.org',
215
215
    >>> list_one.subscribe(cris)
216
216
    >>> transaction.commit()
217
217
 
218
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
218
    >>> sorted(list_one.getSubscribedAddresses())
219
219
    [u'anne.person@example.com', u'bperson@example.org',
220
220
     u'cris.person@example.com']
221
221
    >>> [person.displayname for person in list_one.getSubscribers()]
229
229
Cris may post to the mailing list using any of her registered and validated
230
230
email addresses.
231
231
 
232
 
    >>> sorted(email.email for email in list_one.getSenderAddresses())
 
232
    >>> sorted(list_one.getSenderAddresses())
233
233
    [u'anne.person@example.com', u'aperson@example.org',
234
234
     u'bart.person@example.com', u'bperson@example.org',
235
235
     u'cperson@example.org', u'cris.person@example.com',
250
250
    >>> alternative.email
251
251
    u'cris.x.person@example.net'
252
252
 
253
 
    >>> sorted(email.email for email in list_one.getSenderAddresses())
 
253
    >>> sorted(list_one.getSenderAddresses())
254
254
    [u'anne.person@example.com', u'aperson@example.org',
255
255
     u'bart.person@example.com', u'bperson@example.org',
256
256
     u'cperson@example.org', u'cris.person@example.com',
261
261
    >>> alternative.status = EmailAddressStatus.VALIDATED
262
262
    >>> transaction.commit()
263
263
 
264
 
    >>> sorted(email.email for email in list_one.getSenderAddresses())
 
264
    >>> sorted(list_one.getSenderAddresses())
265
265
    [u'anne.person@example.com', u'aperson@example.org',
266
266
     u'bart.person@example.com', u'bperson@example.org',
267
267
     u'cperson@example.org', u'cris.person@example.com',
297
297
    >>> sub_team_list.subscribe(lars)
298
298
    >>> transaction.commit()
299
299
 
300
 
    >>> sorted(email.email
301
 
    ...        for email in super_team_list.getSubscribedAddresses())
 
300
    >>> sorted(super_team_list.getSubscribedAddresses())
302
301
    [u'lars.person@example.com']
303
 
    >>> sorted(email.email for email in sub_team_list.getSubscribedAddresses())
 
302
    >>> sorted(sub_team_list.getSubscribedAddresses())
304
303
    [u'lars.person@example.com']
305
304
 
306
305
    >>> print_addresses(mailinglist_set.getSenderAddresses(team_names))
337
336
    >>> list_three.subscribe(dirk)
338
337
    >>> transaction.commit()
339
338
 
340
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
339
    >>> sorted(list_one.getSubscribedAddresses())
341
340
    [u'anne.person@example.com', u'bperson@example.org',
342
341
     u'cris.person@example.com', u'dirk.person@example.com']
343
 
    >>> sorted(email.email for email in list_three.getSubscribedAddresses())
 
342
    >>> sorted(list_three.getSubscribedAddresses())
344
343
    [u'dirk.person@example.com']
345
344
 
346
345
    >>> print_addresses(mailinglist_set.getSenderAddresses(team_names))
379
378
    ...     TeamMembershipStatus.DEACTIVATED, salgado)
380
379
    >>> transaction.commit()
381
380
 
382
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
381
    >>> sorted(list_one.getSubscribedAddresses())
383
382
    [u'anne.person@example.com', u'bperson@example.org',
384
383
     u'cris.person@example.com']
385
384
 
426
425
    ...
427
426
    CannotSubscribe: Dirk Person is already subscribed to list Team One
428
427
 
429
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
428
    >>> sorted(list_one.getSubscribedAddresses())
430
429
    [u'anne.person@example.com', u'bperson@example.org',
431
430
     u'cris.person@example.com']
432
431
 
471
470
    >>> list_four.subscribe(elle)
472
471
    >>> transaction.commit()
473
472
 
474
 
    >>> sorted(email.email for email in list_four.getSubscribedAddresses())
 
473
    >>> sorted(list_four.getSubscribedAddresses())
475
474
    [u'elle.person@example.com']
476
475
 
477
476
    >>> print_addresses(mailinglist_set.getSenderAddresses(team_names))
506
505
    >>> elle.setPreferredEmail(elle_alternative)
507
506
    >>> transaction.commit()
508
507
 
509
 
    >>> sorted(email.email for email in list_four.getSubscribedAddresses())
 
508
    >>> sorted(list_four.getSubscribedAddresses())
510
509
    [u'eperson@example.org']
511
510
 
512
511
    >>> print_addresses(mailinglist_set.getSenderAddresses(team_names))
554
553
 
555
554
Any list member can unsubscribe from the mailing list.
556
555
 
557
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
556
    >>> sorted(list_one.getSubscribedAddresses())
558
557
    [u'anne.person@example.com', u'bperson@example.org',
559
558
     u'cris.person@example.com']
560
559
 
561
560
    >>> list_one.unsubscribe(anne)
562
561
    >>> transaction.commit()
563
562
 
564
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
563
    >>> sorted(list_one.getSubscribedAddresses())
565
564
    [u'bperson@example.org', u'cris.person@example.com']
566
565
 
567
566
    >>> print_addresses(mailinglist_set.getSenderAddresses(team_names))
607
606
    >>> bart.leave(team_one)
608
607
    >>> transaction.commit()
609
608
 
610
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
609
    >>> sorted(list_one.getSubscribedAddresses())
611
610
    [u'cris.person@example.com']
612
611
 
613
612
    >>> print_addresses(mailinglist_set.getSenderAddresses(team_names))
647
646
    >>> bart.join(team_two)
648
647
    >>> transaction.commit()
649
648
 
650
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
649
    >>> sorted(list_one.getSubscribedAddresses())
651
650
    [u'bperson@example.org', u'cris.person@example.com']
652
651
 
653
652
    >>> print_addresses(mailinglist_set.getSenderAddresses(team_names))
686
685
    >>> cris.leave(team_two)
687
686
    >>> transaction.commit()
688
687
 
689
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
688
    >>> sorted(list_one.getSubscribedAddresses())
690
689
    [u'bperson@example.org']
691
690
 
692
691
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
720
719
    >>> iona.join(team_five)
721
720
    >>> iona.join(team_two)
722
721
 
723
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
722
    >>> sorted(list_one.getSubscribedAddresses())
724
723
    [u'bperson@example.org']
725
724
 
726
725
    >>> list_one.subscribe(gwen)
728
727
    >>> list_one.subscribe(iona)
729
728
    >>> transaction.commit()
730
729
 
731
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
730
    >>> sorted(list_one.getSubscribedAddresses())
732
731
    [u'bperson@example.org', u'gwen.person@example.com',
733
732
     u'hank.person@example.com', u'iona.person@example.com']
734
733
 
753
752
    ...     TeamMembershipStatus.DEACTIVATED, salgado)
754
753
    >>> transaction.commit()
755
754
 
756
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
755
    >>> sorted(list_one.getSubscribedAddresses())
757
756
    [u'bperson@example.org', u'iona.person@example.com']
758
757
 
759
758
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
795
794
When a team's mailing list is deactivated, all subscriptions to that mailing
796
795
list are dropped.
797
796
 
798
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
797
    >>> sorted(list_one.getSubscribedAddresses())
799
798
    [u'bperson@example.org', u'iona.person@example.com']
800
799
 
801
800
    # Deactivation isn't complete until the list's status is transitioned to
805
804
    >>> list_one.transitionToStatus(MailingListStatus.INACTIVE)
806
805
    >>> transaction.commit()
807
806
 
808
 
    >>> sorted(email.email for email in list_one.getSubscribedAddresses())
 
807
    >>> sorted(list_one.getSubscribedAddresses())
809
808
    []
810
809
 
811
810
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
843
842
    >>> list_six.subscribe(jack)
844
843
    >>> transaction.commit()
845
844
 
846
 
    >>> sorted(email.email for email in list_six.getSubscribedAddresses())
 
845
    >>> sorted(list_six.getSubscribedAddresses())
847
846
    [u'jack.person@example.com']
848
847
 
849
848
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
861
860
    >>> jack.leave(team_six)
862
861
    >>> transaction.commit()
863
862
 
864
 
    >>> sorted(email.email for email in list_six.getSubscribedAddresses())
 
863
    >>> sorted(list_six.getSubscribedAddresses())
865
864
    []
866
865
 
867
866
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
877
876
    >>> jack.join(team_six)
878
877
    >>> transaction.commit()
879
878
 
880
 
    >>> sorted(email.email for email in list_six.getSubscribedAddresses())
 
879
    >>> sorted(list_six.getSubscribedAddresses())
881
880
    [u'jack.person@example.com']
882
881
 
883
882
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
903
902
    >>> list_six.subscribe(kara, kara_alternative)
904
903
    >>> transaction.commit()
905
904
 
906
 
    >>> sorted(email.email for email in list_six.getSubscribedAddresses())
 
905
    >>> sorted(list_six.getSubscribedAddresses())
907
906
    [u'jack.person@example.com', u'kperson@example.org']
908
907
 
909
908
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
921
920
    >>> kara.leave(team_six)
922
921
    >>> transaction.commit()
923
922
 
924
 
    >>> sorted(email.email for email in list_six.getSubscribedAddresses())
 
923
    >>> sorted(list_six.getSubscribedAddresses())
925
924
    [u'jack.person@example.com']
926
925
 
927
926
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
939
938
    >>> kara.join(team_six)
940
939
    >>> transaction.commit()
941
940
 
942
 
    >>> sorted(email.email for email in list_six.getSubscribedAddresses())
 
941
    >>> sorted(list_six.getSubscribedAddresses())
943
942
    [u'jack.person@example.com', u'kperson@example.org']
944
943
 
945
944
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
968
967
    >>> list_six.changeAddress(kara, address)
969
968
    >>> transaction.commit()
970
969
 
971
 
    >> sorted(email.email for email in list_six.getSubscribedAddresses())
 
970
    >> sorted(list_six.getSubscribedAddresses())
972
971
    [u'kara.person@example.com']
973
972
 
974
973
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
987
986
    >>> list_six.changeAddress(kara, address)
988
987
    >>> transaction.commit()
989
988
 
990
 
    >> sorted(email.email for email in list_six.getSubscribedAddresses())
 
989
    >> sorted(list_six.getSubscribedAddresses())
991
990
    [u'kperson@example.org']
992
991
 
993
992
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
1008
1007
    >>> list_six.changeAddress(kara, None)
1009
1008
    >>> transaction.commit()
1010
1009
 
1011
 
    >>> sorted(email.email for email in list_six.getSubscribedAddresses())
 
1010
    >>> sorted(list_six.getSubscribedAddresses())
1012
1011
    [u'kara.person@example.com']
1013
1012
 
1014
1013
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
1028
1027
    >>> kara.setPreferredEmail(address)
1029
1028
    >>> transaction.commit()
1030
1029
 
1031
 
    >>> sorted(email.email for email in list_six.getSubscribedAddresses())
 
1030
    >>> sorted(list_six.getSubscribedAddresses())
1032
1031
    [u'kperson@example.org']
1033
1032
 
1034
1033
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
1076
1075
    >>> transaction.commit()
1077
1076
 
1078
1077
    >>> list_seven.subscribe(sam)
1079
 
    >>> sorted(email.email for email in list_seven.getSubscribedAddresses())
 
1078
    >>> sorted(list_seven.getSubscribedAddresses())
1080
1079
    []
1081
1080
 
1082
1081
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
1093
1092
 
1094
1093
Samuel may not post to the mailing list using any of his addresses.
1095
1094
 
1096
 
    >>> sorted(email.email for email in list_seven.getSenderAddresses())
 
1095
    >>> sorted(list_seven.getSenderAddresses())
1097
1096
    [u'no-priv@canonical.com']
1098
1097
 
1099
1098
    >>> print_addresses(mailinglist_set.getSenderAddresses(team_names))
1125
1124
    >>> sam.join(team_seven)
1126
1125
    >>> transaction.commit()
1127
1126
 
1128
 
    >>> sorted(email.email for email in list_seven.getSubscribedAddresses())
 
1127
    >>> sorted(list_seven.getSubscribedAddresses())
1129
1128
    [u'samuel.person@example.com']
1130
 
    >>> sorted(email.email for email in list_seven.getSenderAddresses())
 
1129
    >>> sorted(list_seven.getSenderAddresses())
1131
1130
    [u'no-priv@canonical.com',
1132
1131
     u'samuel.person@example.com', u'sperson@example.org']
1133
1132
 
1172
1171
    >>> removeSecurityProxy(list_seven).status = MailingListStatus.INACTIVE
1173
1172
    >>> transaction.commit()
1174
1173
 
1175
 
    >>> sorted(email.email for email in list_seven.getSubscribedAddresses())
 
1174
    >>> sorted(list_seven.getSubscribedAddresses())
1176
1175
    []
1177
 
    >>> sorted(email.email for email in list_seven.getSenderAddresses())
 
1176
    >>> sorted(list_seven.getSenderAddresses())
1178
1177
    []
1179
1178
 
1180
1179
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
1218
1217
 
1219
1218
    >>> list_six.changeAddress(kara, kara_alternative)
1220
1219
    >>> transaction.commit()
1221
 
    >>> print sorted(email.email
1222
 
    ...              for email in list_six.getSubscribedAddresses())
 
1220
    >>> print sorted(list_six.getSubscribedAddresses())
1223
1221
    [u'kperson@example.org']
1224
1222
 
1225
1223
    # kara_alternative has been set as kara's preferred email during this
1231
1229
    False
1232
1230
    >>> kara_alternative.destroySelf()
1233
1231
    >>> transaction.commit()
1234
 
    >>> print sorted(email.email
1235
 
    ...              for email in list_six.getSubscribedAddresses())
 
1232
    >>> print sorted(list_six.getSubscribedAddresses())
1236
1233
    []
1237
1234
 
1238
1235
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
1286
1283
    >>> list_nine.subscribe(vera)
1287
1284
    >>> transaction.commit()
1288
1285
 
1289
 
    >>> print sorted(
1290
 
    ...     email.email for email in list_nine.getSubscribedAddresses())
 
1286
    >>> print sorted(list_nine.getSubscribedAddresses())
1291
1287
    [u'umma.person@example.com', u'vera.person@example.com']
1292
1288
 
1293
 
    >>> print sorted(email.email for email in list_nine.getSenderAddresses())
 
1289
    >>> print sorted(list_nine.getSenderAddresses())
1294
1290
    [u'no-priv@canonical.com',
1295
1291
     u'umma.person@example.com', u'uperson@example.org',
1296
1292
     u'vera.person@example.com', u'vperson@example.org']
1344
1340
 
1345
1341
Umma is no longer subscribed to the mailing list...
1346
1342
 
1347
 
    >>> print sorted(
1348
 
    ...     email.email for email in list_nine.getSubscribedAddresses())
 
1343
    >>> print sorted(list_nine.getSubscribedAddresses())
1349
1344
    [u'vera.person@example.com']
1350
1345
 
1351
1346
    >>> print_addresses(mailinglist_set.getSubscribedAddresses(team_names))
1364
1359
 
1365
1360
...and she can no longer post directly to the mailing list.
1366
1361
 
1367
 
    >>> print sorted(email.email for email in list_nine.getSenderAddresses())
 
1362
    >>> print sorted(list_nine.getSenderAddresses())
1368
1363
    [u'no-priv@canonical.com',
1369
1364
     u'vera.person@example.com', u'vperson@example.org']
1370
1365