@staticmethod<EOL><INDENT>def serializeFields(data):<DEDENT>
if isinstance(data, MambuStruct):<EOL><INDENT>return data.serializeStruct()<EOL><DEDENT>try:<EOL><INDENT>it = iter(data)<EOL><DEDENT>except TypeError as terr:<EOL><INDENT>return unicode(data)<EOL><DEDENT>if type(it) == type(iter([])):<EOL><INDENT>l = []<EOL>for e in it:<EOL><INDENT>l.append(MambuStruct.serializeFields(e))<EOL><DEDENT>return l<EOL><DEDENT>elif type(it) == type(iter({})):<EOL><INDENT>d = {}<EOL>for k in it:<EOL><INDENT>d[k] = MambuStruct.serializeFields(data[k])<EOL><DEDENT>return d<EOL><DEDENT>return unicode(data)<EOL>
Turns every attribute of the Mambu object in to a string representation.

        If the object is an iterable one, it goes down to each of its
        elements and turns its attributes too, recursively.

        The base case is when it's a MambuStruct class (this one) so it
        just 'serializes' the attr atribute. Refer to
        MambuStruct.serializeStruct pydoc.

        This is perhaps the worst way to do it, still looking for a better way.