old style PropertiesOptionError is now accepted

This commit is contained in:
Emmanuel Garette 2016-11-15 16:38:25 +01:00
parent b49daa1b35
commit 8249b8eb20
1 changed files with 5 additions and 2 deletions

View File

@ -31,7 +31,7 @@ def display_list(lst, separator='and'):
# Exceptions for an Option # Exceptions for an Option
class PropertiesOptionError(AttributeError): class PropertiesOptionError(AttributeError):
"attempt to access to an option with a property that is not allowed" "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.proptype = proptype
self._settings = settings self._settings = settings
self._datas = datas self._datas = datas
@ -40,7 +40,10 @@ class PropertiesOptionError(AttributeError):
def __str__(self): def __str__(self):
#this part is a bit slow, so only execute when display #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 != {}: if req != {}:
msg = [] msg = []
for action, msg_ in req.items(): for action, msg_ in req.items():