plugin names
John Arbash Meinel
john at arbash-meinel.com
Wed Feb 22 14:05:54 GMT 2006
Martin Pool wrote:
> On 22 Feb 2006, Robert Collins <robertc at robertcollins.net> wrote:
>> python limits module names to something approximately like
>> [a-zA-Z_][a-zA-Z0-9_]*
>>
>> Perhaps we should not load plugins that dont meet the python module name
>> criteria, so that bzrlib.plugins.* only contains valid python module
>> names?
>
> That would be OK, though might break some people who have checkouts in
> their plugin directory called say 'gannotate.mbp'.
>
I don't really see why. It is actually possible to use any name using
'getattr' and 'setattr'.
You can do:
>>> x = X()
>>> x.h = 1
>>> setattr(x, 'hello there', 1)
>>> dir(x)
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__',
'__hash__', '__init__', '__module__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__',
'h', 'hello there']
>>> getattr(x, 'hello there')
1
Python doesn't actually restrict you from using extended characters. The
parser just doesn't support accessing them directly.
I would rather just load whatever is there, because of both Martin's
point (people might label the directory by using period), and because I
frequently pun my plugin with the command it provides. (Though I waffle
between pqm-submit, and pqm_submit).
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060222/f19132c2/attachment.pgp
More information about the bazaar
mailing list