I guess it's easier to manage a text file containing one To: address per
line instead of a config file.
The following (untested) patch adds that feature to mailer.py .
(I can't test it since I do not have the bindings installed yet, but I'll
do if there's interest in this feature.)
Martin
[[[
Add support for reading a file containing one To: address per line.
* tools/hook-scripts/mailer/mailer.py:
(MailedOutput.start): Read to_addr_file if set in the config file.
* tools/hook-scripts/mailer/mailer.conf.example: Add to_addr_file.
]]]
Index: tools/hook-scripts/mailer/mailer.py
===================================================================
--- tools/hook-scripts/mailer/mailer.py (revision 35361)
+++ tools/hook-scripts/mailer/mailer.py (working copy)
@@ -224,18 +224,29 @@
OutputBase.__init__(self, cfg, repos, prefix_param)
def start(self, group, params):
- # whitespace (or another character) separated list of addresses
- # which must be split into a clean list
- to_addr_in = self.cfg.get('to_addr', group, params)
- # if list of addresses starts with '[.]'
- # use the character between the square brackets as split char
- # else use whitespaces
- if len(to_addr_in) >= 3 and to_addr_in[0] == '[' \
- and to_addr_in[2] == ']':
- self.to_addrs = \
- [_f for _f in to_addr_in[3:].split(to_addr_in[1]) if _f]
+ to_addr_file = self.cfg.get('to_addr_file', group, params)
+ if len(to_addr_file) > 0:
+ # read to_addr_file containing one To: address per line
+ self.to_addrs = []
+ inputfile = open(to_addr_file, "r")
+ for to_addr in inputfile:
+ to_addr = to_addr.strip()
+ if len(to_addr) > 0:
+ self.to_addrs.append(to_addr.strip())
+ inputfile.close()
else:
- self.to_addrs = [_f for _f in to_addr_in.split() if _f]
+ # whitespace (or another character) separated list of addresses
+ # which must be split into a clean list
+ to_addr_in = self.cfg.get('to_addr', group, params)
+ # if list of addresses starts with '[.]'
+ # use the character between the square brackets as split char
+ # else use whitespaces
+ if len(to_addr_in) >= 3 and to_addr_in[0] == '[' \
+ and to_addr_in[2] == ']':
+ self.to_addrs = \
+ [_f for _f in to_addr_in[3:].split(to_addr_in[1]) if _f]
+ else:
+ self.to_addrs = [_f for _f in to_addr_in.split() if _f]
self.from_addr = self.cfg.get('from_addr', group, params) \
or self.repos.author or 'no_author'
# if the from_addr (also) starts with '[.]' (may happen if one
Index: tools/hook-scripts/mailer/mailer.conf.example
===================================================================
--- tools/hook-scripts/mailer/mailer.conf.example (revision 35361)
+++ tools/hook-scripts/mailer/mailer.conf.example (working copy)
@@ -173,6 +173,10 @@
# brackets '[ ]'.
to_addr = invalid_at_example.com
+# Name of a file containing one To: address per line. If this entry
+# is not empty above to_addr will be ignored.
+to_addr_file =
+
# If this is set, then a Reply-To: will be inserted into the message.
reply_to =
On Wed, 21 Jan 2009, Greg Stein wrote:
> I take it that your system somehow allows for altering the invocation
> of the commit-email.pl script? As each user wants to receive email,
> they simply throw themselves onto the command line?
>
> This would seem to imply that the hook script which invokes
> commit-email gets rewritten each time somebody wants to receive an
> email. It seems that you could have a simple mailer.conf per
> repository, a constant hook script, and your system just rewrites the
> .conf to append/remove people from the to_addr list. Would that work
> in your situation?
>
> [looking at mailer.py and commit-email stuffs today]
>
> Cheers,
> -g
>
> On Tue, Nov 11, 2008 at 08:12, Michiel Holtkamp <michiel_at_elfstone.nl> wrote:
>> For mailer question, see below.
>>
>> On Nov 11, 2008, at 16:01 , Daniel Shahaf wrote:
>>
>>> I'm not wearing my PM hat in this thread. The place to ask is the list,
>>> so CCing them, maybe they'll know the answer to your question.
>>
>> Whoops, I missed that.
>>
>> Ok list, does anyone have an answer to the following question?
>>
>> I'm using commit-email.pl for my project (http://supermind.nl/submin/)
>> sousers can configure themselves if they want to receive email for every
>> commit. It seems that mailer.py is not able to send emails without
>> specifying alle the emails in the config-file. To write a specific
>> config-file each commit (or check if users changed their settings since the
>> last commit) seems a bit bothersome and error-prone to me.
>>
>> Is there a better solution, other than using commit-email.pl (deprecated) or
>> mailer.py (only email addresses in config file)?
>>
>> Thanks in advance,
>> Michiel
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
>> For additional commands, e-mail: dev-help_at_subversion.tigris.org
>>
>>
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1040899
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1041153
Received on 2009-01-21 14:02:56 CET