From d7e93cbda97792904dd08b3318f7d3c22e6533f4 Mon Sep 17 00:00:00 2001 From: George Sibble Date: Thu, 7 Mar 2013 12:43:46 -0600 Subject: [PATCH] Fix Object Type Detection to Not Incorrectly Convert Booleans and 0 Integers to None Prior to this patch, zero integers and False booleans were being converted to None since both evaluate the origin if statement (it not obj) to True. Signed-off-by: George Sibble --- src/main/resources/python/swagger.mustache | 2 +- src/main/resources/python3/swagger.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/python/swagger.mustache b/src/main/resources/python/swagger.mustache index 20428d278e5..c635d85b90d 100644 --- a/src/main/resources/python/swagger.mustache +++ b/src/main/resources/python/swagger.mustache @@ -98,7 +98,7 @@ class ApiClient: def sanitizeForSerialization(self, obj): """Dump an object into JSON for POSTing.""" - if not obj: + if type(obj) == type(None): return None elif type(obj) in [str, int, long, float, bool]: return obj diff --git a/src/main/resources/python3/swagger.mustache b/src/main/resources/python3/swagger.mustache index 3dec8b0d215..2fcb394fe33 100644 --- a/src/main/resources/python3/swagger.mustache +++ b/src/main/resources/python3/swagger.mustache @@ -102,7 +102,7 @@ class ApiClient: def sanitizeForSerialization(self, obj): """Dump an object into JSON for POSTing.""" - if not obj: + if type(obj) == type(None): return None elif type(obj) in [str, int, float, bool]: return obj