[pygi] Prepend gi.repository to the __module__ attribute of wrapper classes.



commit 6156f15cb15b4c20e975527227135d49207c520a
Author: Tomeu Vizoso <tomeu vizoso collabora co uk>
Date:   Tue May 25 14:08:51 2010 +0200

    Prepend gi.repository to the __module__ attribute of wrapper classes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=619597

 gi/module.py     |    4 ++--
 tests/test_gi.py |    4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gi/module.py b/gi/module.py
index 6223fd4..e1326aa 100644
--- a/gi/module.py
+++ b/gi/module.py
@@ -100,7 +100,7 @@ class DynamicModule(object):
                     wrapper = flags_add(g_type)
 
                 wrapper.__info__ = info
-                wrapper.__module__ = info.get_namespace()
+                wrapper.__module__ = 'gi.repository.' + info.get_namespace()
 
                 for value_info in info.get_values():
                     name = value_info.get_name().upper()
@@ -140,7 +140,7 @@ class DynamicModule(object):
             name = info.get_name()
             dict_ = {
                 '__info__': info,
-                '__module__': self._namespace,
+                '__module__': 'gi.repository.' + self._namespace,
                 '__gtype__': g_type
             }
             wrapper = metaclass(name, bases, dict_)
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 7158e74..eab9c8d 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -1602,4 +1602,6 @@ class TestOverrides(unittest.TestCase):
 
         self.assertTrue(isinstance(object_, GIMarshallingTests.OverridesObject))
 
-
+    def test_module_name(self):
+        self.assertEquals(GIMarshallingTests.OverridesStruct.__module__, 'gi.overrides.GIMarshallingTests')
+        self.assertEquals(GObject.InitiallyUnowned.__module__, 'gi.repository.GObject')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]