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

Re: [PATCH] option mapping in mailer.py

From: Mathias Weinert <mathias.weinert_at_gfa-net.de>
Date: 2006-05-30 15:58:33 CEST

C. Michael Pilato wrote:
> Mathias Weinert wrote:
> > Hi there,
> >
> > I am still hoping that some will commit the following patch to mailer.py
> > so please let my wishes get true...
> >
> > This patch allows users to use capital letters for map substitution
> > names. If you use a map substitution name with capital letters in the
> > current release of mailer.py it won't work as all option names are
> > converted to lower case but not the name of the value.
> >
> > So I changed this to a way that the value is also converted to lower
> > case and added some hints to the config examples file.
> >
> > Mathias
> >
> > [[[
> > * tools/hook-scripts/mailer/mailer.py
> > - 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
> > - added a hint to the description of the mapping process
> > ]]]
> >
> > --- mailer.py.orig 2006-05-23 02:17:16.000000000 +0200
> > +++ mailer.py 2006-05-30 08:55:36.726937900 +0200
> > @@ -1108,7 +1108,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:
> > --- mailer.conf.example.orig 2005-04-15 16:37:19.000000000 +0200
> > +++ mailer.conf.example 2006-05-30 08:58:15.360520500 +0200
> > @@ -240,9 +240,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.
>
> These additiona; notes are tipping your hand regarding implementation
> details a user doesn't care about it. It should be sufficient to say:
>
> # 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.
> #
> # NOTE: Avoid using multiple map substitution names which differ only
> # in case. Unexpected results may occur.
>

Agreed (but avoid double " ").

But in order to make it work right the patch still has to be applied.
Would you mind committing it?

> > +# Please note that a colon ':' is also considered as separator between
> > +# option and value (keep this in mind when trying to map a file path under
> > +# windows).
>
> Mm... nice warning!
>

Mathias

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue May 30 15:59:13 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.