old style PropertiesOptionError is now accepted
authorEmmanuel Garette <egarette@cadoles.com>
Tue, 15 Nov 2016 15:38:25 +0000 (16:38 +0100)
committerEmmanuel Garette <egarette@cadoles.com>
Tue, 15 Nov 2016 15:38:25 +0000 (16:38 +0100)
tiramisu/error.py

index 2ccf27f..5c86fc1 100644 (file)
@@ -31,7 +31,7 @@ def display_list(lst, separator='and'):
 # Exceptions for an Option
 class PropertiesOptionError(AttributeError):
     "attempt to access to an option with a property that is not allowed"
-    def __init__(self, msg, proptype, settings, datas, option_type):
+    def __init__(self, msg, proptype, settings=None, datas=None, option_type=None):
         self.proptype = proptype
         self._settings = settings
         self._datas = datas
@@ -40,7 +40,10 @@ class PropertiesOptionError(AttributeError):
 
     def __str__(self):
         #this part is a bit slow, so only execute when display
-        req = self._settings.apply_requires(**self._datas)
+        if self._settings is None:
+            req = {}
+        else:
+            req = self._settings.apply_requires(**self._datas)
         if req != {}:
             msg = []
             for action, msg_ in req.items():