From d424c9cd0b75964b2117a03cbdf8f2392bb64281 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 19 Mar 2020 09:44:06 +0100 Subject: [PATCH] remove unecessery description in response --- src/risotto/message.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/risotto/message.py b/src/risotto/message.py index a96b8ca..415312f 100644 --- a/src/risotto/message.py +++ b/src/risotto/message.py @@ -189,13 +189,12 @@ class ResponseDefinition: if value.startswith('[]'): value = '[]{}'.format(CUSTOMTYPES[version][tvalue].type) else: - value = CUSTOMTYPES[version][value].type + value = CUSTOMTYPES[version][tvalue].type + self.description = CUSTOMTYPES[version][tvalue].description else: - self._valid_type(value) + raise Exception('only customtype is supported in response') elif key == 'description': - if value.endswith('.'): - value = value[:-1] - value = MESSAGE_TRANSLATION(value) + raise Exception('description is not allowed in response') setattr(self, key, value) # check mandatory keys for key in self.__slots__: @@ -204,12 +203,6 @@ class ResponseDefinition: except AttributeError: 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, version):