From 4d05b5d81f07cde411c4426a0584c63f28e7db24 Mon Sep 17 00:00:00 2001 From: George Sibble Date: Tue, 16 Jul 2013 14:20:49 -0700 Subject: [PATCH] Only check in lists and dictionaries The "in" operator also works on strings which can cause problems with this line if the attribute and the object are named the same thing. Signed-off-by: George Sibble --- src/main/resources/python/swagger.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/python/swagger.mustache b/src/main/resources/python/swagger.mustache index c635d85b90d..b5761bbfb56 100644 --- a/src/main/resources/python/swagger.mustache +++ b/src/main/resources/python/swagger.mustache @@ -159,7 +159,7 @@ class ApiClient: instance = objClass() for attr, attrType in instance.swaggerTypes.iteritems(): - if attr in obj: + if attr in obj and type(obj) in [list, dict]: value = obj[attr] if attrType in ['str', 'int', 'long', 'float', 'bool']: attrType = eval(attrType)