On Tue, Apr 08, 2003 at 08:39:04PM -0700, Blair Zajac wrote:
> cmpilato@collab.net wrote:
> >
> > Blair Zajac <blair@orcaware.com> writes:
> >
> > > Can somebody with some Python fu check this? This sets the from address
> > > to the revision author if no from_addr is set or it is set like this
> > > from_addr =
> > >
> > > I'm not certain about the == None and == "" tests.
> > >
> > > Blair
> > >
> > >
> > > Index: mailer.py
> > > ===================================================================
> > > --- mailer.py (revision 5592)
> > > +++ mailer.py (working copy)
> > > @@ -157,6 +157,10 @@
> > > def start(self, group, params):
> > > self.to_addr = self.cfg.get('to_addr', group, params)
> > > self.from_addr = self.cfg.get('from_addr', group, params)
> > > + if self.from_addr == None or self.from_addr == "":
> > > + self.from_addr = self.repos.author
> > > + if self.from_addr == None or self.from_addr == "":
> > > + self.from_addr = 'no_author'
> > > self.reply_to = self.cfg.get('reply_to', group, params)
> >
> > If I'm understanding the module docs correctly, the self.cfg.get()
> > will throw a NoOptionError if the option doesn't exist at all.
> > Presumably this is what you want to check for (as well as the ""
> > case).
>
> That doesn't appear to be the case. I just tried commenting out all
> from_addr and there's no exception.
In that case, how about:
def start(self, group, params):
self.to_addr = self.cfg.get('to_addr', group, params)
- self.from_addr = self.cfg.get('from_addr', group, params)
+ self.from_addr = self.cfg.get('from_addr', group, params) or \
+ self.repos.author and 'no_author'
self.reply_to = self.cfg.get('reply_to', group, params)
--
Michael Wood <mwood@its.uct.ac.za>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Apr 9 16:43:32 2003