From 0ef3700dee56c06bfd3efc20cdb9135bb320de06 Mon Sep 17 00:00:00 2001 From: Kurt Rose Date: Fri, 4 Apr 2014 12:03:53 -0700 Subject: [PATCH] fix bug that weakref.ref() count as Iterable and Sized, but cause a TypeError when passed to the list constructor --- clastic/render/simple.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clastic/render/simple.py b/clastic/render/simple.py index f780101..9e12583 100644 --- a/clastic/render/simple.py +++ b/clastic/render/simple.py @@ -25,7 +25,10 @@ def default(self, obj): except: pass if isinstance(obj, Sized) and isinstance(obj, Iterable): - return list(obj) + try: + return list(obj) + except: + pass if callable(getattr(obj, 'to_dict', None)): return obj.to_dict()