[MERGE][Bug #103023] More informative error message when plugins have an invalid name
Robert Collins
robertc at robertcollins.net
Mon Nov 12 18:23:56 GMT 2007
Robert Collins has voted tweak.
Status is now: Conditionally approved
Comment:
Couple of things. Your indenting is a little funky. And the santised
string might be clearer if you use re.sub, and the message should say
'file path' rather than 'this' for clarity.:
=== modified file 'bzrlib/plugin.py'
--- bzrlib/plugin.py 2007-08-29 01:50:37 +0000
+++ bzrlib/plugin.py 2007-11-06 09:14:14 +0000
@@ -191,8 +191,11 @@
except Exception, e:
## import pdb; pdb.set_trace()
if re.search('\.|-| ', name):
- warning('Unable to load plugin %r from %r: '
- 'It is not a valid python module name.' % (name,
d))
+ sanitised_name = re.sub([._ -]', '_', name)
+ warning("Unable to load %r in %r as a plugin because
the path isn't"
+ " a valid module name; try renaming it to %r."
+ % (name, d,
sanitised_name))
For details, see:
http://bundlebuggy.aaronbentley.com/request/%3C20071107074743.27659a63%40lapbert%3E
More information about the bazaar
mailing list