diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2017-12-07 04:04:09 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2018-01-02 10:47:15 +0800 |
commit | f505dab1f5f26154619ec5c30cabbd8efaad173e (patch) | |
tree | 212e39f635abf72e41d5335be23895b31384c8f6 /testapi/opnfv_testapi/handlers/pod_handlers.py | |
parent | 25345fc94b0cfa24df4fc37cf4aa6befeaefad59 (diff) |
leverage query_by_name decorator to simplify name querying
name query is case insensitive and partial match
Change-Id: I65a6f5d3aa9411559cb9cf27d0fbd7ec46d4b26f
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'testapi/opnfv_testapi/handlers/pod_handlers.py')
-rw-r--r-- | testapi/opnfv_testapi/handlers/pod_handlers.py | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/testapi/opnfv_testapi/handlers/pod_handlers.py b/testapi/opnfv_testapi/handlers/pod_handlers.py index 06a8b17..03c2033 100644 --- a/testapi/opnfv_testapi/handlers/pod_handlers.py +++ b/testapi/opnfv_testapi/handlers/pod_handlers.py @@ -6,7 +6,6 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -import re from opnfv_testapi.handlers import base_handlers from opnfv_testapi.models import pod_models @@ -19,14 +18,6 @@ class GenericPodHandler(base_handlers.GenericApiHandler): self.table = 'pods' self.table_cls = pod_models.Pod - def set_query(self): - query = dict() - for k in self.request.query_arguments.keys(): - v = self.get_query_argument(k) - if k == 'name': - query['name'] = re.compile(v, re.IGNORECASE) - return query - class PodCLHandler(GenericPodHandler): @swagger.operation(nickname='listAllPods') @@ -40,7 +31,7 @@ class PodCLHandler(GenericPodHandler): @in name: query @required name: False """ - self._list(query=self.set_query()) + self._list() @swagger.operation(nickname='createPod') def post(self): |