def render(self, depth=0):
        children = []
        next_depth = depth + 1 if self.name else depth
        for child in self.children:
            if isinstance(child, XMLObject):
                child = child.render(depth+1)
            else:
                #child = "  "*(depth+1) + unicode(child)
                child = unicode(child)
            children.append(child)
        #children = u"\n".join(children)
        children = u"".join(children)

        if self.name:
            options = u"".join([u' %s="%s"' % (opt, val) for (opt, val) in self.options.items()])
            if (not children) and self.collapsable:
                return u"<%s%s />" % (self.name, options)
            else:
                return u"<%(name)s%(options)s>%(children)s</%(name)s>" % {
                    'name':self.name, 'options':options, 'children':children}
        else:
            return children
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/app_manager/xml_utils.py/XMLTag.render/original