[gobject-introspection] giscanner.message: Fix module-level logging functions



commit 1be0372c2f6653f0a434e88ef1431507bd47e33d
Author: Mikhail Zabaluev <mikhail zabaluev gmail com>
Date:   Wed Sep 30 19:30:30 2015 +0300

    giscanner.message: Fix module-level logging functions
    
    MessageLogger.get() calls the class constructor without arguments.
    The __init__ signature, however, did not default the namespace parameter,
    so any usage of the logging functions caused a bogus exception.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755890

 giscanner/message.py |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/giscanner/message.py b/giscanner/message.py
index 065ee25..e79a813 100644
--- a/giscanner/message.py
+++ b/giscanner/message.py
@@ -97,7 +97,7 @@ class Position(object):
 class MessageLogger(object):
     _instance = None
 
-    def __init__(self, namespace, output=None):
+    def __init__(self, namespace=None, output=None):
         if output is None:
             output = sys.stderr
         self._cwd = os.getcwd()
@@ -158,8 +158,12 @@ class MessageLogger(object):
             text = '%s\n%s\n%s' % (text, marker_line, ' ' * marker_pos + '^')
 
         if prefix:
-            text = ('%s: %s: %s: %s: %s\n' % (last_position, error_type,
-                                              self._namespace.name, prefix, text))
+            if self._namespace:
+                text = ('%s: %s: %s: %s: %s\n' % (last_position, error_type,
+                                                  self._namespace.name, prefix, text))
+            else:
+                text = ('%s: %s: %s: %s\n' % (last_position, error_type,
+                                              prefix, text))
         else:
             if self._namespace:
                 text = ('%s: %s: %s: %s\n' % (last_position, error_type,


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