diff options
author | Garrett Regier <garrettregier@gmail.com> | 2015-01-20 17:25:15 -0800 |
---|---|---|
committer | Garrett Regier <garrettregier@gmail.com> | 2015-02-04 06:29:07 -0800 |
commit | 557abb55ee4429ebe6f48aed5a67950c0374b043 (patch) | |
tree | f40cad33efb4efbe175a85b5fcc4e1af319b67d6 /loaders | |
parent | 8b01d0c1cbc9525281fc5cde4678a0ba4f20f111 (diff) | |
download | libpeas-557abb55ee4429ebe6f48aed5a67950c0374b043.tar.gz |
Support Python plugins that define __all__
Instead of going through every local in the
plugin just check those in __all__, if defined.
https://bugzilla.gnome.org/show_bug.cgi?id=741802
Diffstat (limited to 'loaders')
-rw-r--r-- | loaders/python/peas-python-internal.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/loaders/python/peas-python-internal.py b/loaders/python/peas-python-internal.py index d14b4d8..f05b840 100644 --- a/loaders/python/peas-python-internal.py +++ b/loaders/python/peas-python-internal.py @@ -131,7 +131,13 @@ class Hooks(object): except KeyError: pass - for key in module.__dict__: + try: + keys = module.__all__ + + except AttributeError: + keys = module.__dict__ + + for key in keys: value = getattr(module, key) try: |