From d6b482755b4912a247444ddbda5a66a5eff7e5b8 Mon Sep 17 00:00:00 2001 From: Mike Grima Date: Mon, 30 Jul 2018 13:49:41 -0700 Subject: [PATCH] Proper flask_restful boolean parsing. This is documented here: https://github.com/flask-restful/flask-restful/issues/488 --- lemur/certificates/views.py | 10 +++++----- lemur/notifications/views.py | 4 ++-- lemur/pending_certificates/views.py | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lemur/certificates/views.py b/lemur/certificates/views.py index cdfd06a3..72b38bab 100644 --- a/lemur/certificates/views.py +++ b/lemur/certificates/views.py @@ -9,7 +9,7 @@ import base64 from builtins import str from flask import Blueprint, make_response, jsonify, g -from flask_restful import reqparse, Api +from flask_restful import reqparse, Api, inputs from lemur.common.schema import validate_schema from lemur.common.utils import paginated_parser @@ -132,9 +132,9 @@ class CertificatesList(AuthenticatedResource): """ parser = paginated_parser.copy() parser.add_argument('timeRange', type=int, dest='time_range', location='args') - parser.add_argument('owner', type=bool, location='args') + parser.add_argument('owner', type=inputs.boolean, location='args') parser.add_argument('id', type=str, location='args') - parser.add_argument('active', type=bool, location='args') + parser.add_argument('active', type=inputs.boolean, location='args') parser.add_argument('destinationId', type=int, dest="destination_id", location='args') parser.add_argument('creator', type=str, location='args') parser.add_argument('show', type=str, location='args') @@ -756,9 +756,9 @@ class NotificationCertificatesList(AuthenticatedResource): """ parser = paginated_parser.copy() parser.add_argument('timeRange', type=int, dest='time_range', location='args') - parser.add_argument('owner', type=bool, location='args') + parser.add_argument('owner', type=inputs.boolean, location='args') parser.add_argument('id', type=str, location='args') - parser.add_argument('active', type=bool, location='args') + parser.add_argument('active', type=inputs.boolean, location='args') parser.add_argument('destinationId', type=int, dest="destination_id", location='args') parser.add_argument('creator', type=str, location='args') parser.add_argument('show', type=str, location='args') diff --git a/lemur/notifications/views.py b/lemur/notifications/views.py index df75aaa9..4a2d82a8 100644 --- a/lemur/notifications/views.py +++ b/lemur/notifications/views.py @@ -7,7 +7,7 @@ .. moduleauthor:: Kevin Glisson """ from flask import Blueprint -from flask_restful import Api, reqparse +from flask_restful import Api, reqparse, inputs from lemur.notifications import service from lemur.notifications.schemas import notification_input_schema, notification_output_schema, notifications_output_schema @@ -103,7 +103,7 @@ class NotificationsList(AuthenticatedResource): :statuscode 200: no error """ parser = paginated_parser.copy() - parser.add_argument('active', type=bool, location='args') + parser.add_argument('active', type=inputs.boolean, location='args') args = parser.parse_args() return service.render(args) diff --git a/lemur/pending_certificates/views.py b/lemur/pending_certificates/views.py index 81b0671e..13598040 100644 --- a/lemur/pending_certificates/views.py +++ b/lemur/pending_certificates/views.py @@ -5,7 +5,7 @@ .. moduleauthor:: James Chuong """ from flask import Blueprint, g, make_response, jsonify -from flask_restful import Api, reqparse +from flask_restful import Api, reqparse, inputs from lemur.auth.service import AuthenticatedResource from lemur.auth.permissions import CertificatePermission @@ -110,9 +110,9 @@ class PendingCertificatesList(AuthenticatedResource): """ parser = paginated_parser.copy() parser.add_argument('timeRange', type=int, dest='time_range', location='args') - parser.add_argument('owner', type=bool, location='args') + parser.add_argument('owner', type=inputs.boolean, location='args') parser.add_argument('id', type=str, location='args') - parser.add_argument('active', type=bool, location='args') + parser.add_argument('active', type=inputs.boolean, location='args') parser.add_argument('destinationId', type=int, dest="destination_id", location='args') parser.add_argument('creator', type=str, location='args') parser.add_argument('show', type=str, location='args')