[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] mail address handling and option mapping in mailer.py

From: Mathias Weinert <mathias.weinert_at_gfa-net.de>
Date: 2006-05-03 11:05:52 CEST

Hi there

I first posted this patch in January and then several times again
(e.g. http://svn.haxx.se/dev/archive-2006-02/0293.shtml). Since that
the patch was neither committed nor refused.

So I kindly ask you again to commit this patch to mailer.py (or to
definitely refuse) it.

If there are objections about the new parameter 'to_addr_split_char'
here are some alternatives:

1. Change the default behavior from whitespace to comma
   -> May result in problems for people updating to this version
2. Introduce a new parameter to specify the separator
   -> As I did in my patch
3. Introduce a new parameter for to_addr which will be splitted
   by comma and deprecate the current one
   -> That's what Greg Stein proposed
4. Introduce a new parameter for to_addr which will be splitted
   by comma and then add these mail addresses to the ones given
   by the current to_addr parameter
   -> No deprecation, no update problems, but two parameters for
      the same thing

Thank you very much!

Mathias

[[[
* tools/hook-scripts/mailer/mailer.py
  - new option 'to_addr_split_char' added which allows to use another character but the default whitespaces to separate different mail addresses
  - it's now possible to use capital letters in option values which will be passed through a map

* tools/hook-scripts/mailer/mailer.conf.example
  - new option 'to_addr_split_char' added which allows to use another character but the default whitespaces to separate different mail addresses
  - added a hint to the description of the mapping process
]]]

--- tools/hook-scripts/mailer/mailer.py.new 2006-01-19 22:02:53.150000000 +0100
+++ tools/hook-scripts/mailer/mailer.py.2 2006-01-20 10:39:41.171196600 +0100
@@ -183,9 +183,15 @@
     OutputBase.__init__(self, cfg, repos, prefix_param)
 
   def start(self, group, params):
- # whitespace-separated list of addresses; split into a clean list:
- self.to_addrs = \
- filter(None, string.split(self.cfg.get('to_addr', group, params)))
+ # whitespace (or as set by to_addr_split_char)-separated list
+ # of addresses; split into a clean list:
+ if self.cfg.is_set('general.to_addr_split_char'):
+ self.to_addrs = \
+ filter(None, string.split(self.cfg.get('to_addr', group, params), \
+ self.cfg.general.to_addr_split_char))
+ else:
+ self.to_addrs = \
+ filter(None, string.split(self.cfg.get('to_addr', group, params)))
     self.from_addr = self.cfg.get('from_addr', group, params) \
                      or self.repos.author or 'no_author'
     self.reply_to = self.cfg.get('reply_to', group, params)
@@ -1109,7 +1115,8 @@
         # then just return the value unchanged.
         setattr(self.maps, optname,
                 lambda value,
- sect=getattr(self, sectname): getattr(sect, value,
+ sect=getattr(self, sectname): getattr(sect,
+ value.lower(),
                                                              value))
         # mark for removal when all optnames are done
         if sectname not in mapsections:
--- tools/hook-scripts/mailer/mailer.conf.example.new 2006-01-19 22:02:53.280000000 +0100
+++ tools/hook-scripts/mailer/mailer.conf.example.2 2006-01-20 10:35:59.913921200 +0100
@@ -27,6 +27,12 @@
 #smtp_username = example
 #smtp_password = example
 
+# If this option is set to a character this character will be used
+# to split the mail addresses given to_addr.
+# If this option is not set all whitespace characters (but no comma)
+# are used for splitting.
+#to_addr_split_char = ,
+
 # --------------------------------------------------------------------------
 
 #
@@ -167,7 +173,8 @@
 from_addr = invalid@example.com
 
 # The default To: addresses for message. One or more addresses,
-# separated by whitespace (no commas):
+# separated by whitespace (no commas) or the character set at
+# to_addr_split_char.
 to_addr = invalid@example.com
 
 # If this is set, then a Reply-To: will be inserted into the message.
@@ -242,9 +249,18 @@
 # are made here in the [maps] section.
 #
 # When an option is accessed, the value is loaded from the configuration
-# file and all %(NAME)s substitutions are performed. The resulting value
-# is then passed through the map. If a map entry is not available for
-# the value, then it will be used unchanged.
+# file and all %(NAME)s substitutions are performed. The resulting
+# value(*) is then passed through the map. If a map entry is not available
+# for the value, then it will be used unchanged(**).
+#
+# (*) In fact the value passing and comparing is done case insensitive so
+# don't use values which only differ in case.
+#
+# (**) unchanged means the original value, i. e. no case change is done.
+#
+# Please note that a colon ':' is also considered as separator between
+# option and value. For mapping of filepaths under windows see example 2
+# below.
 #
 # The format to declare a map is:
 #

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed May 3 11:06:54 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.