[bzr-email:MERGE] cleanup imports

Robert Collins robertc at robertcollins.net
Wed Feb 7 19:48:03 GMT 2007


On Wed, 2007-02-07 at 09:52 -0600, John Arbash Meinel wrote:

> 
> What do you think about this change? It cleans up the importing to be
> lazy, as well as check that the plugin is installed with the expected
> name. If it isn't, it errors out quickly, rather than at post-commit time.

+1 as it stands.

> Technically if we wanted we could actually use '__name__' to not require
> a specific import name, by switching to
> 
> this_mod = __import__(__name__, globals(), locals(), ['emailer'])
> emailer = getattr(this_mod, 'emailer')
> 
> Or we could just switch and do
> 
> import emailer
> 
> rather than using
> 
> import bzrlib.plugins.email.emailer
> 
> I'm happy enough with this patch, are you?

I like it as it is. Being truely dynamic about plugin name would just
mean that noone else can depend on our email logic for their plugin,
such as the pqm plugin - and they must have common code nowadays ;).

Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070208/d815b3dd/attachment.pgp 


More information about the bazaar mailing list