some improvemnt

This commit is contained in:
Emmanuel Garette 2019-02-15 23:04:30 +01:00
parent e73e6322ae
commit 1d677e47ef
1 changed files with 9 additions and 9 deletions

View File

@ -88,7 +88,7 @@ class TiramisuOptionOption:
'username': 'username',
'string': 'str',
'symlink': 'symlink'}
if self.schema['type'] in types :
if self.schema['type'] in types:
return types[self.schema['type']]
raise Exception('unsupported type {}'.format(self.schema['type']))
@ -96,7 +96,7 @@ class TiramisuOptionOption:
props = []
model = self.model.get(self._path, {})
if model.get('required'):
#FIXME 'empty', 'needs_len'
# FIXME 'empty', 'needs_len'
props.append('mandatory')
if model.get('readOnly'):
props.append('frozen')
@ -151,9 +151,9 @@ class _Value:
withwarning: bool):
for key, option in schema['properties'].items():
hidden = self.temp.get(key, {}).get('hidden', None)
model_hidden = not self.model.get(key, {}).get('hidden', False) and \
model_display = not self.model.get(key, {}).get('hidden', False) and \
self.model.get(key, {}).get('display', True)
if hidden is False or (hidden is None and model_hidden):
if hidden is False or (hidden is None and model_display is True):
if option['type'] == 'object':
self._dict_walk(ret,
option,
@ -283,9 +283,9 @@ class _Option:
for path, schema in self.schema['properties'].items():
if type == 'all' or schema['type'] not in ['object', 'array']:
hidden = self.temp.get(path, {}).get('hidden', None)
model_hidden = not self.model.get(path, {}).get('hidden', False) and \
model_display = not self.model.get(path, {}).get('hidden', False) and \
self.model.get(path, {}).get('display', True)
if hidden is False or (hidden is None and model_hidden is True):
if hidden is False or (hidden is None and model_display is True):
if schema['type'] in ['object', 'array']:
yield TiramisuOptionDescription(self.config,
schema,
@ -344,9 +344,9 @@ class TiramisuOptionDescription(_Option):
def group_type(self):
hidden = self.temp.get(self.path, {}).get('hidden', None)
model_hidden = not self.model.get(self.path, {}).get('hidden', False) and \
model_display = not self.model.get(self.path, {}).get('hidden', False) and \
self.model.get(self.path, {}).get('display', True)
if hidden is False or (hidden is None and model_hidden):
if hidden is False or (hidden is None and model_display):
# FIXME
return 'default'
raise PropertiesOptionError(None, None, None, opt_type='optiondescription')
@ -637,7 +637,7 @@ class Config:
update_last_action = True
elif index == None and action == 'delete':
for update in reversed(self.updates):
if masterslaves == None and update['name'] == path or \
if masterslaves is None and update['name'] == path or \
masterslaves and path.startswith(masterslaves + '.'):
del self.updates[-1]
else: