def _serialize(value): """Convert a Python primitive to a phyloXML-compatible Unicode string (PRIVATE).""" if isinstance(value, float): return unicode(value).upper() elif isinstance(value, bool): return unicode(value).lower() return unicode(value)
def characters(self, content): """Replace quotes and apostrophe.""" content = escape(unicode(content)) for a, b in ((u'"', u'"'), (u"'", u''')): content = content.replace(a, b) self.write(content)
def characters(self, content): content = escape(unicode(content)) for a, b in ((u'"', u'"'), (u"'", u''')): content = content.replace(a, b) self.write(content)
def match(node): return unicode(node) == target
def pair_as_kwarg_string(key, val): if isinstance(val, basestring): return "%s='%s'" % (key, _utils.trim_str(unicode(val), 60, u'...')) return "%s=%s" % (key, val)