[Mailman-Developers] Discard patch

Alan Batie alan@batie.org
Wed, 3 Jul 2002 02:22:25 -0700


---------------------- multipart/mixed attachment
I still think that a language that applies semantics to indentation is
silly (though I can remember wishing for it a few times when I was learning
programming ;-) ), but at least you guys have written good readable code,
even for a non-python guy.

Here's the patches to add "discard_nonmember_postings" as an option; it
only has effect if member_posting_only is also set and the datafile version
is revved to 22 to add it in automatically.

I was trying to fix the fact that member_posting_only doesn't properly
default, but it seems to be in RadioButtonArray and I can't find that
anywhere, either in mailman or in python.  Maybe it's cuz it's after 2am.
Oh well.

While I was looking at that, I saw a comment that said something like
"i'd rather have Logout have a blank line in front of it instead of being
a big font", so I fixed that too --- kindof a hack, but one I find works
well all over the place.  That's the second patch, FWIW...

-- 
Alan Batie                   ______    www.rdrop.com/users/alan      Me
alan@batie.org               \    /    www.qrd.org         The Triangle
PGPFP DE 3C 29 17 C0 49 7A    \  /     www.pgpi.com   The Weird Numbers
27 40 A5 3C 37 4A DA 52 B9     \/      razor.sourceforge.net   NO SPAM!

    A free society is a place where it's safe to be unpopular.
    -Adlai Stevenson, statesman (1900-1965)

---------------------- multipart/mixed attachment
*** Handlers/Hold.py.org	Wed Jul  3 01:14:43 2002
--- Handlers/Hold.py	Wed Jul  3 01:15:16 2002
***************
*** 149,155 ****
             not Utils.FindMatchingAddresses(sender, posters):
              # the sender is neither a member of the list, nor in the list of
              # explicitly approved posters
!             hold_for_approval(mlist, msg, msgdata, NonMemberPost)
              # no return
      elif mlist.posters:
          posters = Utils.List2Dict(map(string.lower, mlist.posters))
--- 149,159 ----
             not Utils.FindMatchingAddresses(sender, posters):
              # the sender is neither a member of the list, nor in the list of
              # explicitly approved posters
! 	    if mlist.discard_nonmember_postings:
! 		# if discarding, just signal all done
! 		raise NonMemberPost
! 	    else:
! 		hold_for_approval(mlist, msg, msgdata, NonMemberPost)
              # no return
      elif mlist.posters:
          posters = Utils.List2Dict(map(string.lower, mlist.posters))
*** Defaults.py.in.org	Wed Jul  3 01:19:57 2002
--- Defaults.py.in	Wed Jul  3 01:19:59 2002
***************
*** 342,348 ****
  DEFAULT_OBSCURE_ADDRESSES = 1
  
  # Make it 1 when it works.
! DEFAULT_MEMBER_POSTING_ONLY = 0
  
  
  
--- 342,351 ----
  DEFAULT_OBSCURE_ADDRESSES = 1
  
  # Make it 1 when it works.
! DEFAULT_MEMBER_POSTING_ONLY = 1
! 
! # Discard mail from non-members --- it's all spam anyway
! DEFAULT_DISCARD_NONMEMBER_POSTINGS = 0
  
  
  
*** MailList.py.org	Tue Jul  2 22:36:41 2002
--- MailList.py	Wed Jul  3 01:13:57 2002
***************
*** 323,328 ****
--- 323,329 ----
  	self.private_roster = mm_cfg.DEFAULT_PRIVATE_ROSTER
  	self.obscure_addresses = mm_cfg.DEFAULT_OBSCURE_ADDRESSES
  	self.member_posting_only = mm_cfg.DEFAULT_MEMBER_POSTING_ONLY
+ 	self.discard_nonmember_postings = mm_cfg.DEFAULT_DISCARD_NONMEMBER_POSTINGS
  	self.host_name = mm_cfg.DEFAULT_HOST_NAME
          self.admin_member_chunksize = mm_cfg.DEFAULT_ADMIN_MEMBER_CHUNKSIZE
          self.administrivia = mm_cfg.DEFAULT_ADMINISTRIVIA
***************
*** 660,665 ****
--- 661,674 ----
               " If you want list members to be able to"
               " post, plus a handful of other posters, see the <i> posters </i>"
               " setting below"),
+ 
+ 	    ('discard_nonmember_postings', mm_cfg.Radio, ('No', 'Yes'), 0,
+ 	     'Discard postings from non-members?'
+              ' (<i>discard_nonmember_postings</i>)',
+ 
+              "Use this option if you want to automatically discard postings"
+              " from non-members --- it's usually just spam.  Otherwise, it"
+              " is held and you have to deal with it."),
  
  	    ('posters', mm_cfg.EmailList, (5, WIDTH), 1,
               'Addresses of members accepted for posting to this'
*** Version.py.org	Wed Jul  3 01:13:06 2002
--- Version.py	Wed Jul  3 01:13:57 2002
***************
*** 36,42 ****
                 (REL_LEVEL << 4)  | (REL_SERIAL << 0))
  
  # config.db schema version number
! DATA_FILE_VERSION = 21
  
  # qfile/*.db schema version number
  QFILE_SCHEMA_VERSION = 2
--- 36,42 ----
                 (REL_LEVEL << 4)  | (REL_SERIAL << 0))
  
  # config.db schema version number
! DATA_FILE_VERSION = 22
  
  # qfile/*.db schema version number
  QFILE_SCHEMA_VERSION = 2
*** versions.py.org	Wed Jul  3 01:13:17 2002
--- versions.py	Wed Jul  3 01:13:57 2002
***************
*** 189,194 ****
--- 189,195 ----
      add_only_if_missing('postings_responses', {}, l)
      add_only_if_missing('admin_responses', {}, l)
      add_only_if_missing('reply_goes_to_list', '', l)
+     add_only_if_missing('discard_nonmember_postings', 0, l)
  
  
  

---------------------- multipart/mixed attachment
*** admin.py.org	Wed Jul  3 01:35:10 2002
--- admin.py	Wed Jul  3 02:16:08 2002
***************
*** 287,296 ****
                              'Go to the general list information page'))
      otherlinks.AddItem(Link(mlist.GetScriptURL('edithtml'),
                              'Edit the HTML for the public list pages'))
!     otherlinks.AddItem(Link(mlist.GetBaseArchiveURL(), 'Go to list archives'))
!     otherlinks.AddItem(Link('%s/logout' % adminurl,
!                             # TBD: What I really want is a blank line :/
!                             '<FONT SIZE="+2"><b>Logout</b></FONT>'))
  
      categorylinks = UnorderedList()
      for k, v in CATEGORIES:
--- 287,295 ----
                              'Go to the general list information page'))
      otherlinks.AddItem(Link(mlist.GetScriptURL('edithtml'),
                              'Edit the HTML for the public list pages'))
!     otherlinks.AddItem(Link(mlist.GetBaseArchiveURL(),
! 	'Go to list archives <br><table><tr><td>&nbsp;</table>'))
!     otherlinks.AddItem(Link('%s/logout' % adminurl, '<b>Logout</b>'))
  
      categorylinks = UnorderedList()
      for k, v in CATEGORIES:

---------------------- multipart/mixed attachment--