added self.config to the properties

This commit is contained in:
gwen 2019-02-08 11:24:29 +01:00
parent bec906cd54
commit 05168ca5d0
1 changed files with 3 additions and 0 deletions

View File

@ -113,6 +113,7 @@ class TiramisuOptionOption:
class TiramisuOptionProperty: class TiramisuOptionProperty:
# config.option(path).property # config.option(path).property
def __init__(self, def __init__(self,
self.config,
path: str, path: str,
model: Dict) -> None: model: Dict) -> None:
self.path = path self.path = path
@ -327,6 +328,7 @@ class TiramisuOptionDescription(_Option):
self.form) self.form)
if subfunc == 'property': if subfunc == 'property':
return TiramisuOptionProperty(self.path, return TiramisuOptionProperty(self.path,
self.config,
self.model.get(self.path, {})) self.model.get(self.path, {}))
if subfunc == 'value': if subfunc == 'value':
return TiramisuOptionValue(self.config, return TiramisuOptionValue(self.config,
@ -396,6 +398,7 @@ class TiramisuOption:
if self.index != None: if self.index != None:
raise NotImplementedError() raise NotImplementedError()
return TiramisuOptionProperty(self.path, return TiramisuOptionProperty(self.path,
self.config,
self.model.get(self.path, {})) self.model.get(self.path, {}))
raise APIError(_('please specify a valid sub function ({})').format(subfunc)) raise APIError(_('please specify a valid sub function ({})').format(subfunc))