[pygi] make __all__ be a list of strings, fix override mechanism to use it correctly
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygi] make __all__ be a list of strings, fix override mechanism to use it correctly
- Date: Thu, 29 Apr 2010 15:43:43 +0000 (UTC)
commit 4410abd589a2f64cfbd7bbcb4013fae9e4aa734f
Author: John (J5) Palmieri <johnp redhat com>
Date: Wed Apr 28 13:19:48 2010 -0400
make __all__ be a list of strings, fix override mechanism to use it correctly
* before we were adding classes to the __all__ module property but
the convention is to use the name of the class
* simplified the check to just check the name against __all__
instead of trying to get the class and then checking the class
against None as well as in __all__
* went through all the overrides and made __all__ be a list of strings
gi/module.py | 9 ++++-----
gi/overrides/GIMarshallingTests.py | 2 +-
gi/overrides/Gdk.py | 2 +-
3 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/gi/module.py b/gi/module.py
index 3afdc18..223ea60 100644
--- a/gi/module.py
+++ b/gi/module.py
@@ -174,11 +174,10 @@ class ModuleProxy(object):
self._overrides_module = overrides_module
def __getattr__(self, name):
- attribute = getattr(self._overrides_module, name, None)
- exports = getattr(self._overrides_module, '__all__', ())
- if attribute is not None and attribute not in exports:
- attribute = None
- if attribute is None:
+ override_exports = getattr(self._overrides_module, '__all__', ())
+ if (name in override_exports):
+ attribute = getattr(self._overrides_module, name, None)
+ else:
attribute = getattr(self._dynamic_module, name)
return attribute
diff --git a/gi/overrides/GIMarshallingTests.py b/gi/overrides/GIMarshallingTests.py
index 0cc6915..1ff9147 100644
--- a/gi/overrides/GIMarshallingTests.py
+++ b/gi/overrides/GIMarshallingTests.py
@@ -65,5 +65,5 @@ class OverridesObject(GIMarshallingTests.OverridesObject):
OverridesObject = override(OverridesObject)
-__all__ = [OVERRIDES_CONSTANT, OverridesStruct, OverridesObject]
+__all__ = ['OVERRIDES_CONSTANT', 'OverridesStruct', 'OverridesObject']
diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py
index 48f845b..5048939 100644
--- a/gi/overrides/Gdk.py
+++ b/gi/overrides/Gdk.py
@@ -44,7 +44,7 @@ class Rectangle(Gdk.Rectangle):
Rectangle = override(Rectangle)
-__all__ = [Rectangle]
+__all__ = ['Rectangle']
import sys
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]