From 3962dfe3b87993d971e256d5bc915a39be324d25 Mon Sep 17 00:00:00 2001 From: Xavier Bustamante Talavera Date: Wed, 31 Oct 2018 11:59:12 +0100 Subject: [PATCH] Fix searching for IDs, numbers, HP, and Asus --- ereuse_devicehub/resources/device/views.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ereuse_devicehub/resources/device/views.py b/ereuse_devicehub/resources/device/views.py index a0e4731b..a4bd2fae 100644 --- a/ereuse_devicehub/resources/device/views.py +++ b/ereuse_devicehub/resources/device/views.py @@ -88,7 +88,20 @@ class DeviceView(View): 200: description: The device or devices. """ - return super().get(id) + # Majority of code is from teal + if id: + response = self.one(id) + else: + args = self.QUERY_PARSER.parse(self.find_args, + request, + locations=('querystring',)) + # todo not-nice way of de-parsing what webargs parser + # does when sees that an argument is like an int, etc + # when solving this, change too the Query.search to Str + if args.get('search', False): + args['search'] = str(args['search']) + response = self.find(args) + return response def one(self, id: int): """Gets one device."""