You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Lars Gullik Bjønnes <lg...@tandberg.com> on 2009/04/16 18:13:38 UTC

[PATCH] Add NNTP support to mailer.py

[[[

Add NNTP sending capabilities to mailer.py.

* tools/hook-scripts/mailer/mailer.conf.example: Add example config
  for nntp_hostname and to_group.

* tools/hook-scripts/mailer/mailer.py:
  (class MailedOutput): Rename to MessageOutput.
  (MailedOutput.mail_headers): Rename to message_headers.
  (MessageOutput.start): Add parsing of to_group.
  (MessageOutput.message_headers): Add setup of the "Newsgroups:"
   header.
  (class SMTPOutput): Rename to SMTPAndNNTPOutput.
  (SMTPAndNNTPOutput.__init__): New function.
  (SMTPAndNNTPOutput.start): Use class MessageOutput and
   message_headers.
  (SMTPAndNNTPOutput.finish): Conditionalize mail/news sending based
   on provided configuration.
  (class PipeOutput): Use class MessageOutput and message_headers.
  (class Messenger): Use SMTPAndNNTPOutput as messenger if either
   smtp_hostname or nntp_hostname is set.

]]]

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1751999

Re: [PATCH] Add NNTP support to mailer.py

Posted by Jon Bendtsen <jb...@laerdal.dk>.
What do i do about those of my patches that does not have an issue  
number?



JonB

On 23/05/2009, at 07.35, Gavin 'Beau' Baumanis wrote:

> Hi Jon,
>
> For all of your historical patches there are two things we can do.
> 1) you can send them (the patches) to me (via the dev list) and I  
> can attach them to the issue for you.
> You'll need to send me three things.
> The issue number, the patch and an appropriate comment.
>
> 2)You can attach them to the appropriate issues yourself.
> The benefit of you doing it yourself is that the comments are  
> linkable by email.
> When / if someone finally gets around to doing something with them,  
> if any extra information is required, they'll have your email  
> directly if it's needed.
>
> I am happy to do the work on your behalf - I'm not trying to be  
> slack... - option 2 just looks to be amore "complete" solution, is  
> all.
>
> Also, if YOU attach the patches to the appropriate issue, send a  
> quick message to the dev list - something along the lines of;
> I have attached the following patch, that does... to issue #xx.
>
> It will get your patches back up to the top of the mail list for  
> some more advertising.
>
> Please don't hesitate to ask for any help you might need.
>
>
> Gavin.
>
> On 14/05/2009, at 8:28 PM, Jon Bendtsen wrote:
>
>> On 14/05/2009, at 04.32, Gavin 'Beau' Baumanis wrote:
>>
>>> Hi Jon,
>>>
>>> Since I have only recently taken over the task of Patch Manager -  
>>> It is quite likely that I don't know about them.
>>
>> okay, thank you for taking care of this :-)
>>
>>
>>> If you can give me some thread references I can certainly get them  
>>> going again.
>>
>> I have only posted regularly after making them, so anything in 2009  
>> from me is VERY much likely to be about them.
>>
>> But there is issue 2213 and issue 3227. I think i have sent 5 or 6  
>> patches + the NNTP ones.
>>
>> max_diff_size.txt
>> max_mail_size.txt
>> max_number_of_diffs.txt
>> binary_file_endings.txt
>> header_detail.txt
>>
>> The last one was sameimportfix.txt, but i was wrong about that one.
>>
>> Header_detail will see more development. Some of the patches  
>> collide if you apply them all.
>>
>>
>>
>> JonB
>>
>
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2353445

Re: [PATCH] Add NNTP support to mailer.py

Posted by Gavin Baumanis <ga...@thespidernet.com>.
Hi Jon,

For all of your historical patches there are two things we can do.
1) you can send them (the patches) to me (via the dev list) and I can  
attach them to the issue for you.
You'll need to send me three things.
The issue number, the patch and an appropriate comment.

2)You can attach them to the appropriate issues yourself.
The benefit of you doing it yourself is that the comments are linkable  
by email.
When / if someone finally gets around to doing something with them, if  
any extra information is required, they'll have your email directly if  
it's needed.

I am happy to do the work on your behalf - I'm not trying to be  
slack... - option 2 just looks to be amore "complete" solution, is all.

Also, if YOU attach the patches to the appropriate issue, send a quick  
message to the dev list - something along the lines of;
I have attached the following patch, that does... to issue #xx.

It will get your patches back up to the top of the mail list for some  
more advertising.

Please don't hesitate to ask for any help you might need.


Gavin.

On 14/05/2009, at 8:28 PM, Jon Bendtsen wrote:

> On 14/05/2009, at 04.32, Gavin 'Beau' Baumanis wrote:
>
>> Hi Jon,
>>
>> Since I have only recently taken over the task of Patch Manager -  
>> It is quite likely that I don't know about them.
>
> okay, thank you for taking care of this :-)
>
>
>> If you can give me some thread references I can certainly get them  
>> going again.
>
> I have only posted regularly after making them, so anything in 2009  
> from me is VERY much likely to be about them.
>
> But there is issue 2213 and issue 3227. I think i have sent 5 or 6  
> patches + the NNTP ones.
>
> max_diff_size.txt
> max_mail_size.txt
> max_number_of_diffs.txt
> binary_file_endings.txt
> header_detail.txt
>
> The last one was sameimportfix.txt, but i was wrong about that one.
>
> Header_detail will see more development. Some of the patches collide  
> if you apply them all.
>
>
>
> JonB
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2353092

Re: [PATCH] Add NNTP support to mailer.py

Posted by Jon Bendtsen <jb...@laerdal.dk>.
On 11/05/2009, at 12.12, Gavin 'Beau' Baumanis wrote:

> Hi Jon,
>
>
> If the patch is still under development , thats fine.
> And there's no rush or anything like that either.
>
> I just try to make sure that I perform some sort of follow-up if a  
> patch thread hasn't received any new posts (or hasn't been  
> committed) at a week from it's "last" post.
>
> I guess I'll email you in a week or so - unless you beat me to it  
> with a reply to the thread.

You're welcome.

There are other patches from me which adds features to mailer.py, but  
i have not heard much about those either.


JonB

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2187489

[PATCH] Add NNTP auto_to_group support to mailer.py

Posted by Jon Bendtsen <jb...@laerdal.dk>.
Hi

Here is my patch that automatically finds the group from the path.  
Unfortunately i found out that my
previous code that could automatically create the non existing groups  
does not work if just one group
exists :-( i will have to do something about it.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2193202

Re: [PATCH] Add NNTP support to mailer.py

Posted by Gavin Baumanis <ga...@thespidernet.com>.
Hi Jon,


If the patch is still under development , thats fine.
And there's no rush or anything like that either.

I just try to make sure that I perform some sort of follow-up if a  
patch thread hasn't received any new posts (or hasn't been committed)  
at a week from it's "last" post.

I guess I'll email you in a week or so - unless you beat me to it with  
a reply to the thread.


Gavin.


On 11/05/2009, at 7:09 PM, Jon Bendtsen wrote:

> On 07/05/2009, at 15.18, Gavin Baumanis wrote:
>
>> Lars / Jon,
>>
>> Can I bother you both, please.
>> Can I get confirmation that Jon's last patch is appropriate and works
>> as required?
>
> i dont think my word counts ;-)
>
>
>> Since your posts have received little (outside of you two) extra
>> attention I intend to "file" the patch into the issue tracker, but
>> want to ensure that the correct patch is used.
>
> i am not finished making patch changes. I hope to soon find the time
> to make my
> auto_to_group patch.
>
>
>
> JonB
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2186598

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2187397

Re: [PATCH] Add NNTP support to mailer.py

Posted by Jon Bendtsen <jb...@laerdal.dk>.
On 07/05/2009, at 15.18, Gavin Baumanis wrote:

> Lars / Jon,
>
> Can I bother you both, please.
> Can I get confirmation that Jon's last patch is appropriate and works
> as required?

i dont think my word counts ;-)


> Since your posts have received little (outside of you two) extra
> attention I intend to "file" the patch into the issue tracker, but
> want to ensure that the correct patch is used.

i am not finished making patch changes. I hope to soon find the time  
to make my
auto_to_group patch.



JonB

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2186598

Re: [PATCH] Add NNTP support to mailer.py

Posted by Gavin Baumanis <ga...@thespidernet.com>.
Lars / Jon,

Can I bother you both, please.
Can I get confirmation that Jon's last patch is appropriate and works  
as required?

Since your posts have received little (outside of you two) extra  
attention I intend to "file" the patch into the issue tracker, but  
want to ensure that the correct patch is used.


Gavin.

On 01/05/2009, at 9:16 PM, Gavin 'Beau' Baumanis wrote:

> Ping. This patch proposal has received no comments in over a week.
>
> Gavin.
>
>
> On 23/04/2009, at 7:10 PM, Jon Bendtsen wrote:
>
>> On 22/04/2009, at 20.07, Lars Gullik Bjønnes wrote:
>>
>>> Lars Gullik Bjønnes <lg...@tandberg.com> writes:
>>>
>>> | | Imagine that you have no default values, but control everything
>>> with
>>> | | [maps]. Then it is impossible to only email, or only nntp, which
>>> | | someone might want to do.
>>>>
>>> | The to_group error is mine, but the to_addr one is pre-existing I
>>> | think.
>>>>
>>> | Anyways. I'll look into this and see if things can be made a bit
>>> more
>>> | robust.
>>>
>>> I think this change makes it more robust. What I do not like about  
>>> it
>>> is that if you setup smtp_hostname and/or nntp_hostname and forget
>>> to_addr and to_group you will just not get any output/messages at  
>>> all.
>>
>> well, what if you have some part of your SVN that you dont want email
>> for?
>> But you want to be able to commit anyway.
>> Or if you dont want a default email/usenet address, but want to
>> control it with maps?
>>
>> I think it would be annoying if the committer got an "error" message
>> saying that
>> there is no address to send to.
>>
>>
>>> Note that this is completely untested.
>>
>> i just tested it (in my patch from yesterday) and i dont have any
>> problems.
>>
>>
>>
>> JonB
>>
>> ------------------------------------------------------
>> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1875442
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2094821


Re: [PATCH] Add NNTP support to mailer.py

Posted by Jon Bendtsen <jb...@laerdal.dk>.
On 22/04/2009, at 20.07, Lars Gullik Bjønnes wrote:

> Lars Gullik Bjønnes <lg...@tandberg.com> writes:
>
> | | Imagine that you have no default values, but control everything  
> with
> | | [maps]. Then it is impossible to only email, or only nntp, which
> | | someone might want to do.
>>
> | The to_group error is mine, but the to_addr one is pre-existing I
> | think.
>>
> | Anyways. I'll look into this and see if things can be made a bit  
> more
> | robust.
>
> I think this change makes it more robust. What I do not like about it
> is that if you setup smtp_hostname and/or nntp_hostname and forget
> to_addr and to_group you will just not get any output/messages at all.

well, what if you have some part of your SVN that you dont want email  
for?
But you want to be able to commit anyway.
Or if you dont want a default email/usenet address, but want to  
control it with maps?

I think it would be annoying if the committer got an "error" message  
saying that
there is no address to send to.


> Note that this is completely untested.

i just tested it (in my patch from yesterday) and i dont have any  
problems.



JonB

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1875442


Re: [PATCH] Add NNTP support to mailer.py

Posted by Lars Gullik Bjønnes <lg...@tandberg.com>.
Lars Gullik Bjønnes <lg...@tandberg.com> writes:

| | Imagine that you have no default values, but control everything with  
| | [maps]. Then it is impossible to only email, or only nntp, which  
| | someone might want to do.
>
| The to_group error is mine, but the to_addr one is pre-existing I
| think.
>
| Anyways. I'll look into this and see if things can be made a bit more
| robust.

I think this change makes it more robust. What I do not like about it
is that if you setup smtp_hostname and/or nntp_hostname and forget
to_addr and to_group you will just not get any output/messages at all.

Note that this is completely untested.

diff --git a/tools/hook-scripts/mailer/mailer.py b/tools/hook-scripts/mailer/mai
index be1bd60..d43888a 100755
--- a/tools/hook-scripts/mailer/mailer.py
+++ b/tools/hook-scripts/mailer/mailer.py
@@ -260,14 +260,14 @@ class SMTPAndNNTPOutput(MessageOutput):
     self.write(self.message_headers(group, params))

   def finish(self):
-    if self.do_smtp:
+    if self.do_smtp and self.to_addrs:
       server = smtplib.SMTP(self.cfg.general.smtp_hostname)
       if self.cfg.is_set('general.smtp_username'):
         server.login(self.cfg.general.smtp_username,
                      self.cfg.general.smtp_password)
       server.sendmail(self.from_addr, self.to_addrs, self.buffer.getvalue())
       server.quit()
-    if self.do_nntp:
+    if self.do_nntp and self.to_groups:
       server = nntplib.NNTP(self.cfg.general.nntp_hostname)
       self.buffer.seek(0)
       server.post(self.buffer)


-- 
	Lgb

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1866482


Re: [PATCH] Add NNTP support to mailer.py

Posted by Lars Gullik Bjønnes <lg...@tandberg.com>.
Jon Bendtsen <jb...@laerdal.dk> writes:

| Hi
|
| specifying both email and nntp works fine, i get both email and nntp.
|
| Specifying the SMTP and NNTP server, but not actually using them by  
| specifying a
| 	to_addr
| 	to_group
| gives errors:

Thanks a lot for testing.

| No to_group gives:
| Traceback (most recent call last):
|    File "./mailer.py", line 1375, in <module>
|      sys.argv[3:3+expected_args])
|    File "/var/lib/python-support/python2.5/svn/core.py", line 288, in  
| run_app
|      return apply(func, (application_pool,) + args, kw)
|    File "./mailer.py", line 105, in main
|      messenger.generate()
|    File "./mailer.py", line 412, in generate
|      self.output.finish()
|    File "./mailer.py", line 273, in finish
|      server.post(self.buffer)
|    File "/usr/lib/python2.5/nntplib.py", line 570, in post
|      return self.getresp()
|    File "/usr/lib/python2.5/nntplib.py", line 219, in getresp
|      raise NNTPTemporaryError(resp)
| nntplib.NNTPTemporaryError: 441 Required "Newsgroups" header is missing
|
| No to_addr gives:
| Traceback (most recent call last):
|    File "./mailer.py", line 1375, in <module>
|      sys.argv[3:3+expected_args])
|    File "/var/lib/python-support/python2.5/svn/core.py", line 288, in  
| run_app
|      return apply(func, (application_pool,) + args, kw)
|    File "./mailer.py", line 105, in main
|      messenger.generate()
|    File "./mailer.py", line 412, in generate
|      self.output.finish()
|    File "./mailer.py", line 268, in finish
|      server.sendmail(self.from_addr, self.to_addrs,  
| self.buffer.getvalue())
|    File "/usr/lib/python2.5/smtplib.py", line 703, in sendmail
|      raise SMTPRecipientsRefused(senderrs)
| smtplib.SMTPRecipientsRefused: {}
|
|
|
| Imagine that you have no default values, but control everything with  
| [maps]. Then it is impossible to only email, or only nntp, which  
| someone might want to do.

The to_group error is mine, but the to_addr one is pre-existing I
think.

Anyways. I'll look into this and see if things can be made a bit more
robust.

-- 
	Lgb

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1861110

Re: [PATCH] Add NNTP support to mailer.py

Posted by Jon Bendtsen <jb...@laerdal.dk>.
Hi

I built upon Lars patch. I added Error Checking and Correction. If an  
error occurs while posting to nntp server, then i will catch it and  
try to handle it by running an external program which can parse the  
error message and try to do something about the error. After returning  
to mailer.py, then the message will be tried posting again.

I plan to use this locally to post to:
	$projectname.trunk
	$projectname.branches.$branchname

But if the branchname group isnt made yet, i want to create it and try  
posting again.

This patch misses code that actually finds the branch and project  
names and post to any other group than the one specified in the config  
file.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1863428

Re: [PATCH] Add NNTP support to mailer.py

Posted by Jon Bendtsen <jb...@laerdal.dk>.
Hi

specifying both email and nntp works fine, i get both email and nntp.

Specifying the SMTP and NNTP server, but not actually using them by  
specifying a
	to_addr
	to_group
gives errors:

No to_group gives:
Traceback (most recent call last):
   File "./mailer.py", line 1375, in <module>
     sys.argv[3:3+expected_args])
   File "/var/lib/python-support/python2.5/svn/core.py", line 288, in  
run_app
     return apply(func, (application_pool,) + args, kw)
   File "./mailer.py", line 105, in main
     messenger.generate()
   File "./mailer.py", line 412, in generate
     self.output.finish()
   File "./mailer.py", line 273, in finish
     server.post(self.buffer)
   File "/usr/lib/python2.5/nntplib.py", line 570, in post
     return self.getresp()
   File "/usr/lib/python2.5/nntplib.py", line 219, in getresp
     raise NNTPTemporaryError(resp)
nntplib.NNTPTemporaryError: 441 Required "Newsgroups" header is missing


No to_addr gives:
Traceback (most recent call last):
   File "./mailer.py", line 1375, in <module>
     sys.argv[3:3+expected_args])
   File "/var/lib/python-support/python2.5/svn/core.py", line 288, in  
run_app
     return apply(func, (application_pool,) + args, kw)
   File "./mailer.py", line 105, in main
     messenger.generate()
   File "./mailer.py", line 412, in generate
     self.output.finish()
   File "./mailer.py", line 268, in finish
     server.sendmail(self.from_addr, self.to_addrs,  
self.buffer.getvalue())
   File "/usr/lib/python2.5/smtplib.py", line 703, in sendmail
     raise SMTPRecipientsRefused(senderrs)
smtplib.SMTPRecipientsRefused: {}



Imagine that you have no default values, but control everything with  
[maps]. Then it is impossible to only email, or only nntp, which  
someone might want to do.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1860004