X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=o2common%2Fviews%2Froute.py;h=08621ffd3251e118883342109094448fbf786378;hb=cf48d1f3e4ad5e8a5ca75cc6f5670b25e6817d8a;hp=0941f5814c1e5755e1120d5927044a83745952dc;hpb=4e221e2f91b6a960e31befcf3aa24a1b4e065afc;p=pti%2Fo2.git diff --git a/o2common/views/route.py b/o2common/views/route.py index 0941f58..08621ff 100644 --- a/o2common/views/route.py +++ b/o2common/views/route.py @@ -30,6 +30,8 @@ from flask_restx.model import Model from flask_restx.fields import List, Nested, String from flask_restx.utils import unpack +from o2common.views.route_exception import BadRequestException + from o2common.helper import o2logging logger = o2logging.get_logger(__name__) @@ -128,11 +130,13 @@ class o2_marshal_with(marshal_with): mask_val = '' if 'all_fields' in kwargs: all_fields_without_space = kwargs['all_fields'].replace(" ", "") - all_fields = all_fields_without_space.lower() - if 'true' == all_fields: - selector = self.__gen_selector_from_model_with_value( - self.fields) - mask_val = self.__gen_mask_from_selector(selector) + logger.info('all_fields selector value is {}'.format( + all_fields_without_space)) + # all_fields = all_fields_without_space.lower() + # if 'true' == all_fields: + selector = self.__gen_selector_from_model_with_value( + self.fields) + mask_val = self.__gen_mask_from_selector(selector) elif 'fields' in kwargs and kwargs['fields'] != '': fields_without_space = kwargs['fields'].replace(" ", "") @@ -211,6 +215,9 @@ class o2_marshal_with(marshal_with): if '/' in f: self.__update_selector_tree_value(selector, f, val) continue + if f not in self.fields: + raise BadRequestException( + 'Selector attribute {} not found'.format(f)) selector[f] = val def __update_selector_tree_value(self, m: dict, filter: str, val: bool):