From 0b67f3aeebed81c166c819c97af5990dac777f22 Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Wed, 9 Oct 2013 22:36:55 -0700 Subject: [PATCH] Fix setting string fields to support all types of strings --- capnp/capnp.pyx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/capnp/capnp.pyx b/capnp/capnp.pyx index cb8720d..39634cc 100644 --- a/capnp/capnp.pyx +++ b/capnp/capnp.pyx @@ -410,7 +410,7 @@ cdef _setDynamicField(_DynamicSetterClasses thisptr, field, value, parent): elif value_type is bool: temp = C_DynamicValue.Reader(value) thisptr.set(field, temp) - elif value_type is str: + elif isinstance(value, basestring): temp = C_DynamicValue.Reader(value) thisptr.set(field, temp) elif value_type is list: @@ -429,13 +429,10 @@ cdef _setDynamicField(_DynamicSetterClasses thisptr, field, value, parent): cdef _to_dict(msg): msg_type = type(msg) - print msg_type if msg_type is _DynamicListBuilder or msg_type is _DynamicListReader or msg_type is _DynamicResizableListBuilder: - print 'in list' return [_to_dict(x) for x in msg] if msg_type is _DynamicStructBuilder or msg_type is _DynamicStructReader: - print 'in struct' ret = {} try: which = msg.which() @@ -445,7 +442,6 @@ cdef _to_dict(msg): pass for field in msg.schema.non_union_fields: - print field if msg._has(field): ret[field] = _to_dict(getattr(msg, field))