[MERGE] An SMTPConnection class for bzrlib
John Arbash Meinel
john at arbash-meinel.com
Tue Jun 19 22:55:22 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Aaron Bentley wrote:
> Aaron Bentley has voted +0.
> Status is now: Semi-approved
> Comment:
> The error handling isn't right; it shouldn't be raising
> BzrCommandErrors, because it's not UI code. I think it would make sense
> to just let the smtplib errors pass through.
I think it should be trapping and raising custom errors, but I agree that it
shouldn't raise BzrCommandErrors.
>
> Also, our style is to import modules rather than functions:
> e.g. from email import Utils
>
There is a small (major?) problem in that in python2.4 they are called
"email.Utils" and in python2.5 they are called "email.utils". Come to think of
it, that case isn't handled in the patch (bzr-email does).
In bzr-email I do:
try:
# python <= 2.4
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
from email.Utils import parseaddr
except ImportError:
# python 2.5 moved MIMEText into a better namespace
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.utils import parseaddr
So it is even slightly worse because "email.MIMEText.MIMEText" =>
email.mime.text.MIMEText.
We might be able to do "from email.mime import text as MIMEText" or something
like that, and then use "MIMEText.MIMEText".
But this is one of those cases where I think pragmatism wins out.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGeFDKJdeBCYSNAAMRAigAAJ9tB01t94ckZ/Q+tz9U9uU3lEsloQCaAplu
4RLM0LL4IqkHzXRafgJau8g=
=COi7
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list