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

Re: Bug in mailer.py

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Mon, 18 Feb 2013 23:51:54 +0200

r1447513 fixes the bug you originally reported, Nick.

Peelman, Nick wrote on Mon, Feb 18, 2013 at 16:40:57 -0500:
> While you're in there :)
>
> I was seeing a few more spam points than i liked, and a coupe of them were easy fixes:
>
> def mail_headers(self, group, params):

Can you send this as a proper unidiff (`svn diff` output) against
mailer.py_at_HEAD?

See http://subversion.apache.org/patches for a few other recommendations
that make our lives easier.

Thanks,

Daniel

> from email import Utils
> subject = self.make_subject(group, params)
> try:
> subject.encode('ascii')
> except UnicodeError:
> from email.Header import Header
> subject = Header(subject, 'utf-8').encode()
> hdrs = 'From: %s\n' \
> 'To: %s\n' \
> 'Subject: %s\n' \
> 'Date: %s\n' \
> 'Message-ID: %s\n' \
> 'MIME-Version: 1.0\n' \
> 'Content-Type: text/plain; charset=UTF-8\n' \
> 'Content-Transfer-Encoding: 8bit\n' \
> 'X-Svn-Commit-Project: %s\n' \
> 'X-Svn-Commit-Author: %s\n' \
> 'X-Svn-Commit-Revision: %d\n' \
> 'X-Svn-Commit-Repository: %s\n' \
> % (self.from_addr, ', '.join(self.to_addrs), subject,
> Utils.formatdate(), Utils.make_msgid("r" + str(self.repos.rev)),
> group, self.repos.author or 'no_author', self.repos.rev,
> os.path.basename(self.repos.repos_dir))
> if self.reply_to:
> hdrs = '%sReply-To: %s\n' % (hdrs, self.reply_to)
> return hdrs + '\n'
>
> Adds a Date header and a Message-ID with the revision property embedded at the end. I also have a tweak with a new config line to allow you to ignore the directory inclusion on the subject line entirely (leaving only the revision (eg. r4939)), but unless you're interested, I'm willing to fight that battle another day.
>
>
> -nick
>
> --
> Peelman, Nick
> nick_at_peelman.us
>
>
>
>
> On Feb 18, 2013, at 16:36, Daniel Shahaf <d.s_at_daniel.shahaf.name> wrote:
>
> > Agreed. This was introduced in r1439592. You can use r1439591 for now;
> > I'll commit your fix shortly. Thanks!
> >
> > Peelman, Nick wrote on Mon, Feb 18, 2013 at 15:55:40 -0500:
> >> Using mailer.py fetched from: http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/mailer/
> >>
> >> Running:
> >>
> >>> root_at_svn:/home/svn/agsync/hooks# ./mailer.py commit /home/svn/agsync/ 8160 ../conf/mailer.conf
> >>> Traceback (most recent call last):
> >>> File "./mailer.py", line 1444, in <module>
> >>> sys.argv[3:3+expected_args])
> >>> File "/usr/lib/python2.7/dist-packages/svn/core.py", line 281, in run_app
> >>> return func(application_pool, *args, **kw)
> >>> File "./mailer.py", line 102, in main
> >>> {'author': author,
> >>> UnboundLocalError: local variable 'author' referenced before assignment
> >>
> >>
> >> Fix:
> >>
> >> ~ Line 102:
> >>
> >>> if cmd == 'commit':
> >>> revision = int(cmd_args[0])
> >>> repos = Repository(repos_dir, revision, pool)
> >>> cfg = Config(config_fname, repos,
> >>> {'author': repos.author,
> >>> 'repos_basename': os.path.basename(repos.repos_dir)
> >>> })
> >>> messenger = Commit(pool, cfg, repos)
> >>
> >> Use repos.author instead of just 'author'.
> >>
> >> -nick
> >>
> >> --
> >> Peelman, Nick
> >> nick_at_peelman.us
> >>
> >>
> >>
> >>
> >
> >
>
Received on 2013-02-18 22:52:33 CET

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

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