[MERGE] allow 'import bzrlib.plugins.NAME'
Martin Pool
mbp at canonical.com
Mon Feb 5 10:10:31 GMT 2007
On 3 Feb 2007, Robert Collins <robertc at robertcollins.net> wrote:
> On Fri, 2007-02-02 at 14:07 -0600, John Arbash Meinel wrote:
>
> > What is the traceback in ~/.bzr.log? Having "unable to load" at least
> > tells someone something is wrong.
> >
> > If you are going to have a check, I would actually prefer:
> >
> > if not re.match('\w+'):
> > warning('Unable to load plugin %r from %r: '
> > 'It is not a valid python module name.' % (name, d))
> >
> > That way we handle 'foo.bar' which is also invalid. And might actually
> > cause problems based on what you are doing (import bzrlib.foo.bar)
> > imports something different.
>
> Discussed on irc: re.search('\.-') is a good start.
fwiw I'm happy with the restriction and with putting it into bzrlib.plugins.
I would just add that it would be nice if the error said something like
Unable to load plugin %r from %s:
The name contains the character '%s' which is not allowed in
Python module names.
(Tangentially using %r for quoting is handy but it does get confusing if
the argument is a unicode string.)
--
Martin
More information about the bazaar
mailing list