Re: [Mailman-Users] Writing a custom handler

2013-07-15 Thread Chris Nulk
On 7/3/2013 9:44 PM, Mark Sapiro wrote: On 07/03/2013 07:40 AM, Chris Nulk wrote: Okay. Makes sense. Here is the modified do_discard_globalban code: def do_discard_globalban(mlist, msg, sender): # forward discarded message to site administrator(s) if defined #in mm_cfg.GLOBALBA

Re: [Mailman-Users] Writing a custom handler

2013-07-03 Thread Mark Sapiro
On 07/03/2013 07:40 AM, Chris Nulk wrote: > > On 7/2/2013 5:23 PM, Mark Sapiro wrote: >> On 07/02/2013 03:09 PM, Chris Nulk wrote: >> >> Not necessary to lowercase sender here as msg.get_senders() always >> returns lowercased addresses unless called with a preserve_case argument >> with a True va

Re: [Mailman-Users] Writing a custom handler

2013-07-03 Thread Chris Nulk
On 7/2/2013 5:23 PM, Mark Sapiro wrote: On 07/02/2013 03:09 PM, Chris Nulk wrote: In the updated code, I did change the populating of the banlist in the Read_GlobalBan_File function. Now, it strips and lowercases the addresses before it checks if the address is in the banlist. Before, it check

Re: [Mailman-Users] Writing a custom handler

2013-07-02 Thread Mark Sapiro
On 07/02/2013 03:09 PM, Chris Nulk wrote: > > Thank you for the help. Hopefully a last question. In the > do_discard_globalban function, how can I send the discard message to > mailman list? Or should I? As it stands now, each list owner/admin > would be getting the message for their list. I

Re: [Mailman-Users] Writing a custom handler

2013-07-02 Thread Chris Nulk
On 7/2/2013 2:37 PM, Mark Sapiro wrote: If you raise some exception other than the Mailman.Errors exceptions DiscardMessage, HoldMessage or RejectMessage, it will be the same as if you didn't catch the exception, i.e., the exception will be logged in the 'error' log with a traceback and the mess

Re: [Mailman-Users] Writing a custom handler

2013-07-02 Thread Mark Sapiro
On 07/02/2013 01:49 PM, Chris Nulk wrote: > > On 7/2/2013 12:17 PM, Mark Sapiro wrote: >> On 07/02/2013 11:38 AM, Chris Nulk wrote: >>> except: >>> # unspecified error >>> # log it and continue with the next pipeline handler >>> syslog('error', >>>

Re: [Mailman-Users] Writing a custom handler

2013-07-02 Thread Chris Nulk
On 7/2/2013 12:17 PM, Mark Sapiro wrote: On 07/02/2013 11:38 AM, Chris Nulk wrote: I did forget about some of my other questions. I plan on writing another custom handler for a list-specific issue. Where would I look if I wanted to intercept messages related to subscribing, unsubscribing, an

Re: [Mailman-Users] Writing a custom handler

2013-07-02 Thread Mark Sapiro
On 07/02/2013 11:38 AM, Chris Nulk wrote: > > > I did forget about some of my other questions. I plan on writing > another custom handler for a list-specific issue. Where would I look if > I wanted to intercept messages related to subscribing, unsubscribing, > and options processing? These ar

Re: [Mailman-Users] Writing a custom handler

2013-07-02 Thread Chris Nulk
On 7/2/2013 10:16 AM, Mark Sapiro wrote: On 07/02/2013 08:48 AM, Chris Nulk wrote: You could change your code as follows: 1) Make the banlist global by putting # First, initialize the banlist banlist = [] ahead of def process(mlist, msg, msgdata): and remove that from the process() defini

Re: [Mailman-Users] Writing a custom handler

2013-07-02 Thread Mark Sapiro
On 07/02/2013 08:48 AM, Chris Nulk wrote: > On 7/1/2013 3:35 PM, Mark Sapiro wrote: >> On 7/1/2013 10:24 AM, Chris Nulk wrote: >>> >>> # Go through possible senders. Check if any of them are >>> # on the global ban list >>> for sender in msg.get_senders(): >>> if sender.

Re: [Mailman-Users] Writing a custom handler

2013-07-02 Thread Chris Nulk
Thank you Mark for your time. I went through and made the syslog change, removed the usenet bit, and correct my typing error. On 7/1/2013 3:35 PM, Mark Sapiro wrote: On 7/1/2013 10:24 AM, Chris Nulk wrote: Hello user, I am writing a custom handler to globally ban email address from sending

Re: [Mailman-Users] Writing a custom handler

2013-07-01 Thread Mark Sapiro
On 7/1/2013 10:24 AM, Chris Nulk wrote: > Hello user, > > I am writing a custom handler to globally ban email address from sending > messages sent to Mailman. I know I can use Mark's add_banned.py script > to add an address to all lists. However, if I add an address to be > banned, as the admini

[Mailman-Users] Writing a custom handler

2013-07-01 Thread Chris Nulk
Hello user, I am writing a custom handler to globally ban email address from sending messages sent to Mailman. I know I can use Mark's add_banned.py script to add an address to all lists. However, if I add an address to be banned, as the administrator for all lists, I don't want a list admin