Rev 31: merge trunk in file:///v/home/vila/.bazaar/plugins/email/

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue May 6 21:33:41 BST 2008


At file:///v/home/vila/.bazaar/plugins/email/

------------------------------------------------------------
revno: 31
revision-id: v.ladeuil+lp at free.fr-20080506203341-hcz2rlw7wod0wzco
parent: v.ladeuil+lp at free.fr-20071017150847-6v3nzyiq2i6fhmcc
parent: john at arbash-meinel.com-20080501225950-1qerrg9fp54ifmel
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: email
timestamp: Tue 2008-05-06 22:33:41 +0200
message:
  merge trunk
modified:
  README                         README-20051018071212-c081f89570802202
  __init__.py                    __init__.py-20051018071212-f1765ec4521cab0b
  smtp_connection.py             smtp_connection.py-20070125220755-k6ueimjqwn16wvr9-1
    ------------------------------------------------------------
    revno: 29.1.4
    revision-id: john at arbash-meinel.com-20080501225950-1qerrg9fp54ifmel
    parent: john at arbash-meinel.com-20080501200121-ovzt249cbaffyyps
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: email
    timestamp: Thu 2008-05-01 17:59:50 -0500
    message:
      Switch to using 'is not None'
    modified:
      __init__.py                    __init__.py-20051018071212-f1765ec4521cab0b
    ------------------------------------------------------------
    revno: 29.1.3
    revision-id: john at arbash-meinel.com-20080501200121-ovzt249cbaffyyps
    parent: john at arbash-meinel.com-20080429140252-782b2ugttsbpnxkp
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: email
    timestamp: Thu 2008-05-01 15:01:21 -0500
    message:
      Use install_named_hook if it is available
    modified:
      __init__.py                    __init__.py-20051018071212-f1765ec4521cab0b
    ------------------------------------------------------------
    revno: 29.1.2
    revision-id: john at arbash-meinel.com-20080429140252-782b2ugttsbpnxkp
    parent: robertc at robertcollins.net-20071114180445-o0zqawr901smlcn2
    author: Scott Wilson <scott-idealist at launchpad.net>
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: email
    timestamp: Tue 2008-04-29 09:02:52 -0500
    message:
      Raise the right errors when smtp connection, etc fails. (bug #224202)
      
      We were raising a raw BzrCommandError, but had only imported 'from bzrlib import errors'
    modified:
      smtp_connection.py             smtp_connection.py-20070125220755-k6ueimjqwn16wvr9-1
    ------------------------------------------------------------
    revno: 29.1.1
    revision-id: robertc at robertcollins.net-20071114180445-o0zqawr901smlcn2
    parent: robertc at robertcollins.net-20070919213805-jo3n2ljmdhg3mcwv
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: trunk
    timestamp: Thu 2007-11-15 05:04:45 +1100
    message:
      Provide a feedback/contact address.
    modified:
      README                         README-20051018071212-c081f89570802202
-------------- next part --------------
=== modified file 'README'
--- a/README	2007-07-08 00:05:11 +0000
+++ b/README	2007-11-14 18:04:45 +0000
@@ -23,5 +23,8 @@
 
  - support format specifiers / email templates.
 
-
-
+Feedback/Contributions
+----------------------
+
+Feedback and contributions should be sent to the Bazaar mailing list:
+bazaar at lists.canonical.com.

=== modified file '__init__.py'
--- a/__init__.py	2007-07-08 06:57:27 +0000
+++ b/__init__.py	2008-05-01 22:59:50 +0000
@@ -89,9 +89,13 @@
 
 def install_hooks():
     """Install CommitSender to send after commits with bzr >= 0.15 """
-    Branch.hooks.install_hook('post_commit', branch_commit_hook)
-    if getattr(Branch.hooks, 'name_hook', None):
-        Branch.hooks.name_hook(branch_commit_hook, "bzr-email")
+    install_named_hook = getattr(Branch.hooks, 'install_named_hook', None)
+    if install_named_hook is not None:
+        install_named_hook('post_commit', branch_commit_hook, 'bzr-email')
+    else:
+        Branch.hooks.install_hook('post_commit', branch_commit_hook)
+        if getattr(Branch.hooks, 'name_hook', None) is not None:
+            Branch.hooks.name_hook(branch_commit_hook, "bzr-email")
 
 
 def test_suite():

=== modified file 'smtp_connection.py'
--- a/smtp_connection.py	2007-01-26 15:23:32 +0000
+++ b/smtp_connection.py	2008-04-29 14:02:52 +0000
@@ -28,9 +28,11 @@
     from email.mime.text import MIMEText
     from email.mime.multipart import MIMEMultipart
     from email.utils import parseaddr
+import socket
 import smtplib
 
 from bzrlib import (
+    errors,
     ui,
     __version__ as _bzrlib_version,
     )
@@ -67,7 +69,13 @@
     def _create_connection(self):
         """Create an SMTP connection."""
         self._connection = smtplib.SMTP()
-        self._connection.connect(self._smtp_server)
+        try:
+            self._connection.connect(self._smtp_server)
+        except socket.error, e:
+            raise errors.SocketConnectionError(
+                host=self._smtp_server,
+                msg="Unable to connect to smtp server to send email to",
+                orig_error=e)
 
         # If this fails, it just returns an error, but it shouldn't raise an
         # exception unless something goes really wrong (in which case we want
@@ -87,13 +95,13 @@
         try:
             self._connection.login(self._smtp_username, self._smtp_password)
         except smtplib.SMTPHeloError, e:
-            raise BzrCommandError('SMTP server refused HELO: %d %s'
-                                  % (e.smtp_code, e.smtp_error))
+            raise errors.BzrCommandError('SMTP server refused HELO: %d %s'
+                                         % (e.smtp_code, e.smtp_error))
         except smtplib.SMTPAuthenticationError, e:
-            raise BzrCommandError('SMTP server refused authentication: %d %s'
-                                  % (e.smtp_code, e.smtp_error))
+            raise errors.BzrCommandError('SMTP server refused authentication: %d %s'
+                                         % (e.smtp_code, e.smtp_error))
         except smtplib.SMTPException, e:
-            raise BzrCommandError(str(e))
+            raise errors.BzrCommandError(str(e))
 
     @staticmethod
     def _split_address(address):



More information about the bazaar-commits mailing list