remove unecessery description in response

This commit is contained in:
Emmanuel Garette 2020-03-19 09:44:06 +01:00
parent c442abe674
commit d424c9cd0b

View File

@ -189,13 +189,12 @@ class ResponseDefinition:
if value.startswith('[]'): if value.startswith('[]'):
value = '[]{}'.format(CUSTOMTYPES[version][tvalue].type) value = '[]{}'.format(CUSTOMTYPES[version][tvalue].type)
else: else:
value = CUSTOMTYPES[version][value].type value = CUSTOMTYPES[version][tvalue].type
self.description = CUSTOMTYPES[version][tvalue].description
else: else:
self._valid_type(value) raise Exception('only customtype is supported in response')
elif key == 'description': elif key == 'description':
if value.endswith('.'): raise Exception('description is not allowed in response')
value = value[:-1]
value = MESSAGE_TRANSLATION(value)
setattr(self, key, value) setattr(self, key, value)
# check mandatory keys # check mandatory keys
for key in self.__slots__: for key in self.__slots__:
@ -204,12 +203,6 @@ class ResponseDefinition:
except AttributeError: except AttributeError:
raise Exception(_('mandatory key not set {}').format(key)) raise Exception(_('mandatory key not set {}').format(key))
def _valid_type(self, typ):
if typ.startswith('[]'):
self._valid_type(typ[2:])
elif typ not in ['Boolean', 'String', 'Number', 'File', 'Dict']:
raise Exception(_('unknown parameter type: {}').format(typ))
def _parse_parameters(raw_defs, def _parse_parameters(raw_defs,
version): version):