Commits

Ronny Pfannschmidt committed c60c464

lookups rock

Comments (0)

Files changed (1)

validator-markip-format-cleanup

 # User Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
 # Date 1280876358 -7200
 # Node ID 5d747f356bfc547439b23bd62b5b2f225851cf50
-# Parent f9d89ccc19e59f68bf1962d9bc6a566eb4597e5a
+# Parent 985a4f0089877903d25796735027805edb55b6bb
 imported patch validator-markip-format-cleanup
 
 diff --git a/pida-plugins/python/python.py b/pida-plugins/python/python.py
 diff --git a/pida/utils/languages.py b/pida/utils/languages.py
 --- a/pida/utils/languages.py
 +++ b/pida/utils/languages.py
-@@ -121,52 +121,42 @@ class ValidationError(InitObject):
+@@ -122,52 +122,41 @@ class ValidationError(InitObject):
      filename = None
      lineno = None
  
 -        # FIXME
 -        pass
 +    def _type_color(self):
-+        if self.type_ == 'error':
-+            return self.lookup_color('pida-val-error')
-+        elif self.type_ == 'info':
-+            return self.lookup_color('pida-val-info')
-+        elif self.type_ == 'warning':
-+            return self.lookup_color('pida-val-warning')
-+        else:
-+            return self.lookup_color('pida-val-def')
++        mapping = {
++            'error': 'pida-val-error',
++            'info': 'pida-val-info',
++            'warning': 'pida-val-warning',
++        }
++        lookup = mapping.get(self._type, 'pida-val-def')
++        return self.lookup_color(lookup)
  
 -    def get_markup(self):
 -        if self.type_ == 'error':