Merge lp:~msapiro/mailman/topics into lp:mailman/2.2

Proposed by Mark Sapiro
Status: Needs review
Proposed branch: lp:~msapiro/mailman/topics
Merge into: lp:mailman/2.2
Diff against target: 193 lines (+70/-33)
5 files modified
Mailman/Cgi/options.py (+34/-5)
Mailman/Gui/Topics.py (+4/-2)
Mailman/Handlers/CalcRecips.py (+6/-5)
Mailman/versions.py (+10/-0)
templates/en/options.html (+16/-21)
To merge this branch: bzr merge lp:~msapiro/mailman/topics
Reviewer Review Type Date Requested Status
Barry Warsaw design code Pending
Review via email: mp+2598@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mark Sapiro (msapiro) wrote :

This proposal is to merge a fix for bug #255418 to allow a list member to receive all messages which match no defined topic without receiving any messages which match any topics. Review of both the design of the fix and the code are requested.

lp:~msapiro/mailman/topics updated
1010. By Mark Sapiro

Merged changes from 2.2 branch.

1011. By Mark Sapiro

Merged changes from 2.2 branch.

1012. By Mark Sapiro

Merged changes from 2.2 branch

1013. By Mark Sapiro

Merged changes from 2.2 branch.

1014. By Mark Sapiro

Merged changes from 2.2 branch.

1015. By Mark Sapiro

Merged changes from 2.2 branch.

1016. By Mark Sapiro

Merges from 2.2 branch

1017. By Mark Sapiro

Merges from 2.2 branch

1018. By Mark Sapiro

Merged changes from 2.2 branch

1019. By Mark Sapiro

Merged change from 2.2 branch

1020. By Mark Sapiro

Merged changes from 2.2 branch.

1021. By Mark Sapiro

Merged changes from 2.2 branch.

1022. By Mark Sapiro

Merged the 2.2 branch.

Unmerged revisions

1022. By Mark Sapiro

Merged the 2.2 branch.

1021. By Mark Sapiro

Merged changes from 2.2 branch.

1020. By Mark Sapiro

Merged changes from 2.2 branch.

1019. By Mark Sapiro

Merged change from 2.2 branch

1018. By Mark Sapiro

Merged changes from 2.2 branch

1017. By Mark Sapiro

Merges from 2.2 branch

1016. By Mark Sapiro

Merges from 2.2 branch

1015. By Mark Sapiro

Merged changes from 2.2 branch.

1014. By Mark Sapiro

Merged changes from 2.2 branch.

1013. By Mark Sapiro

Merged changes from 2.2 branch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Mailman/Cgi/options.py'
--- Mailman/Cgi/options.py 2014-11-08 01:22:26 +0000
+++ Mailman/Cgi/options.py 2014-12-03 23:52:29 +0000
@@ -569,7 +569,6 @@
569 ('disablemail', mm_cfg.DisableDelivery),569 ('disablemail', mm_cfg.DisableDelivery),
570 ('conceal', mm_cfg.ConcealSubscription),570 ('conceal', mm_cfg.ConcealSubscription),
571 ('remind', mm_cfg.SuppressPasswordReminder),571 ('remind', mm_cfg.SuppressPasswordReminder),
572 ('rcvtopic', mm_cfg.ReceiveNonmatchingTopics),
573 ('nodupes', mm_cfg.DontReceiveDuplicates),572 ('nodupes', mm_cfg.DontReceiveDuplicates),
574 ):573 ):
575 try:574 try:
@@ -619,6 +618,7 @@
619 topicnames = [topicnames]618 topicnames = [topicnames]
620 # unquote the topic names619 # unquote the topic names
621 topicnames = [urllib.unquote_plus(n) for n in topicnames]620 topicnames = [urllib.unquote_plus(n) for n in topicnames]
621 rcvtopic = int(cgidata.getvalue('rcvtopic'), 0)
622622
623 # The standard sigterm handler (see above)623 # The standard sigterm handler (see above)
624 def sigterm_handler(signum, frame, mlist=mlist):624 def sigterm_handler(signum, frame, mlist=mlist):
@@ -646,6 +646,21 @@
646 mustdigest = 1646 mustdigest = 1
647 # Set the topics information.647 # Set the topics information.
648 mlist.setMemberTopics(user, topicnames)648 mlist.setMemberTopics(user, topicnames)
649 # And the non-matching option
650 if rcvtopic == 1:
651 mlist.setMemberOption(user, mm_cfg.ReceiveNonmatchingTopics, 1)
652 elif rcvtopic == 0:
653 mlist.setMemberOption(user, mm_cfg.ReceiveNonmatchingTopics, 0)
654 if topicnames:
655 doc.addError(
656 _('With selected topics All is coerced to Only'),
657 tag=_('Notice: '))
658 else:
659 mlist.setMemberOption(user, mm_cfg.ReceiveNonmatchingTopics, 0)
660 if not topicnames:
661 doc.addError(
662 _('With no selected topics Only is coerced to All'),
663 tag=_('Notice: '))
649 mlist.Save()664 mlist.Save()
650 finally:665 finally:
651 mlist.Unlock()666 mlist.Unlock()
@@ -854,10 +869,24 @@
854 else:869 else:
855 topicsfield = _('<em>No topics defined</em>')870 topicsfield = _('<em>No topics defined</em>')
856 replacements['<mm-topics>'] = topicsfield871 replacements['<mm-topics>'] = topicsfield
857 replacements['<mm-suppress-nonmatching-topics>'] = (872 # Figure out the nonmatching selection
858 mlist.FormatOptionButton(mm_cfg.ReceiveNonmatchingTopics, 0, user))873 if not mlist.topics or (not usertopics and not
859 replacements['<mm-receive-nonmatching-topics>'] = (874 mlist.getMemberOption(user, mm_cfg.ReceiveNonmatchingTopics)):
860 mlist.FormatOptionButton(mm_cfg.ReceiveNonmatchingTopics, 1, user))875 topicselectval = 0
876 elif (usertopics and not
877 mlist.getMemberOption(user, mm_cfg.ReceiveNonmatchingTopics)):
878 topicselectval = 2
879 else:
880 topicselectval = 1
881 table = Table(border="0")
882 table.AddRow([RadioButton('rcvtopic', 2, checked=topicselectval==2),
883 _('Only')])
884 table.AddRow([RadioButton('rcvtopic', 1, checked=topicselectval==1),
885 _('Non-match')])
886 table.AddRow([RadioButton('rcvtopic', 0, checked=topicselectval==0),
887 _('All')])
888 topicselection = table.Format()
889 replacements['<mm-nonmatching-topics-selection>'] = topicselection
861890
862 if cpuser is not None:891 if cpuser is not None:
863 replacements['<mm-case-preserved-user>'] = _('''892 replacements['<mm-case-preserved-user>'] = _('''
864893
=== modified file 'Mailman/Gui/Topics.py'
--- Mailman/Gui/Topics.py 2009-02-09 23:30:34 +0000
+++ Mailman/Gui/Topics.py 2014-12-03 23:52:29 +0000
@@ -56,8 +56,10 @@
56 match against a topic filter, the message is logically placed56 match against a topic filter, the message is logically placed
57 into a topic <em>bucket</em>. Each user can then choose to only57 into a topic <em>bucket</em>. Each user can then choose to only
58 receive messages from the mailing list for a particular topic58 receive messages from the mailing list for a particular topic
59 bucket (or buckets). Any message not categorized in a topic59 bucket (or buckets). Any message categorized only in topic
60 bucket registered with the user is not delivered to the list.60 buckets not registered with the user is not delivered to the
61 user. Additionally, the user can also choose whether or not to
62 receive those messages not categorized in any topic bucket.
6163
62 <p>Note that this feature only works with regular delivery, not64 <p>Note that this feature only works with regular delivery, not
63 digest delivery.65 digest delivery.
6466
=== modified file 'Mailman/Handlers/CalcRecips.py'
--- Mailman/Handlers/CalcRecips.py 2014-09-19 16:24:03 +0000
+++ Mailman/Handlers/CalcRecips.py 2014-12-03 23:52:29 +0000
@@ -116,9 +116,10 @@
116 # who are interested in one of the hit topics.116 # who are interested in one of the hit topics.
117 for user in recips:117 for user in recips:
118 utopics = mlist.getMemberTopics(user)118 utopics = mlist.getMemberTopics(user)
119 if not utopics:119 if (not utopics and
120 # This user is not interested in any topics, so they get all120 not mlist.getMemberOption(user,
121 # postings.121 mm_cfg.ReceiveNonmatchingTopics)):
122 # This user wants all postings.
122 continue123 continue
123 # BAW: Slow, first-match, set intersection!124 # BAW: Slow, first-match, set intersection!
124 for topic in utopics:125 for topic in utopics:
@@ -132,8 +133,8 @@
132 else:133 else:
133 # The semantics for a message that did not hit any of the pre-canned134 # The semantics for a message that did not hit any of the pre-canned
134 # topics is to troll through the membership list, looking for users135 # topics is to troll through the membership list, looking for users
135 # who selected at least one topic of interest, but turned on136 # who selected no topics, or who selected at least one topic of
136 # ReceiveNonmatchingTopics.137 # interest, but turned on ReceiveNonmatchingTopics.
137 for user in recips:138 for user in recips:
138 if not mlist.getMemberTopics(user):139 if not mlist.getMemberTopics(user):
139 # The user did not select any topics of interest, so he gets140 # The user did not select any topics of interest, so he gets
140141
=== modified file 'Mailman/versions.py'
--- Mailman/versions.py 2014-10-17 15:43:49 +0000
+++ Mailman/versions.py 2014-12-03 23:52:29 +0000
@@ -322,6 +322,16 @@
322 for name, pattern, description, emptyflag in stored_state['topics']:322 for name, pattern, description, emptyflag in stored_state['topics']:
323 pattern = Utils.strip_verbose_pattern(pattern)323 pattern = Utils.strip_verbose_pattern(pattern)
324 l.topics.append((name, pattern, description, emptyflag))324 l.topics.append((name, pattern, description, emptyflag))
325 #
326 # If pre 2.2 list has topics and regular member has no selection, make
327 # sure ReceiveNonmatchingTopics is off for the member.
328 #
329 if stored_state['data_version'] <= 97:
330 if l.topics:
331 for member in l.members.keys():
332 if not l.getMemberTopics(member):
333 l.setMemberOption(member,
334 mm_cfg.ReceiveNonmatchingTopics, 0)
325 # from_is_list was called author_is_list in 2.1.16rc2 (only).335 # from_is_list was called author_is_list in 2.1.16rc2 (only).
326 PreferStored('author_is_list', 'from_is_list',336 PreferStored('author_is_list', 'from_is_list',
327 mm_cfg.DEFAULT_FROM_IS_LIST)337 mm_cfg.DEFAULT_FROM_IS_LIST)
328338
=== modified file 'templates/en/options.html'
--- templates/en/options.html 2004-11-13 23:57:05 +0000
+++ templates/en/options.html 2014-12-03 23:52:29 +0000
@@ -251,35 +251,30 @@
251 By selecting one or more topics, you can filter the251 By selecting one or more topics, you can filter the
252 traffic on the mailing list, so as to receive only a252 traffic on the mailing list, so as to receive only a
253 subset of the messages. If a message matches one of253 subset of the messages. If a message matches one of
254 your selected topics, then you will get the message,254 your selected topics, then you will get the message;
255 otherwise you will not.255 if it matches only non-selected topics, you will not.
256256
257 <p>If a message does not match any topic, the delivery257 <p>If a message does not match any topic, the delivery
258 rule depends on the setting of the option below. If258 rule depends on the setting of the option below.
259 you do not select any topics of interest, you will get259
260 all the messages sent to the mailing list.260 <p>Topics apply only to individual messages. Digest members
261 receive digests containing all messages regardless of topic.
261 </td><td bgcolor="#cccccc">262 </td><td bgcolor="#cccccc">
262 <mm-topics>263 <mm-topics>
263 </td></tr>264 </td></tr>
264265
265 <tr><td bgcolor="#cccccc">266 <tr><td bgcolor="#cccccc">
266 <strong>Do you want to receive messages that do not match any267 <strong>Which messages do you want to receive?</strong><p>
267 topic filter?</strong><p>268 This option describes what the delivery rule is if
268269 there are defined topics above. Selecting <em>Only</em>
269 This option only takes effect if you've subscribed to270 says that you will only receive messages which match
270 at least one topic above. It describes what the271 topics you have selected above. Selecting <em>Non-match</em>
271 default delivery rule is for messages that don't match272 says that you will receive messages which match your
272 any topic filter. Selecting <em>No</em> says that if273 selected topics if any plus those messages which don't
273 the message does not match any topic filters, then you274 match any topics. Selecting <em>All</em> says you will
274 won't get the message, while selecting <em>Yes</em>275 receive all messages regardless of topic.
275 says to deliver such non-matching messages to you.
276
277 <p>If no topics of interest are selected above, then
278 you will receive every message sent to the mailing
279 list.
280 </td><td bgcolor="#cccccc">276 </td><td bgcolor="#cccccc">
281 <mm-suppress-nonmatching-topics>No<br>277 <mm-nonmatching-topics-selection>
282 <mm-receive-nonmatching-topics>Yes
283 </td></tr>278 </td></tr>
284279
285 <tr><td bgcolor="#cccccc">280 <tr><td bgcolor="#cccccc">

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: