

def ToXML(self, fulldoc=True, indentation=0):
    'Turns envelope into serialized XML suitable for transmission.\n\n    Args:\n      fulldoc: Return a full XML document with <?xml...\n      indentation: Indent each line this number of spaces.\n    Returns:\n      An XML document or fragment in string form.\n    '
    assert self._init_timestamp
    if fulldoc:
        template = "<?xml version='1.0' encoding='UTF-8'?>"
    else:
        template = ''
    template += "\n<me:env xmlns:me='http://salmon-protocol.org/ns/magic-env'>\n  <me:encoding>%s</me:encoding>\n  <me:data type='application/atom+xml'>\n%s\n  </me:data>\n  <me:alg>%s</me:alg>\n  <me:sig>\n%s\n  </me:sig>\n</me:env>\n"
    text = (template % (self._encoding, _ToPretty(self._data, 4, 60), self._alg, _ToPretty(self._sig, 4, 60)))
    indented_text = ''
    for line in text.strip().split('\n'):
        indented_text += (((' ' * indentation) + line) + '\n')
    return indented_text

dataset/ETHPy150Open mimecuvalo/helloworld/packages/magicsig/__init__.py Envelope.ToXML/original