def render(self, request): xml = self.target.messages.getMessageById(self.id) if xml: request.setHeader('content-type', 'text/xml') request.write(unicode(XML.toString(xml)).encode('utf-8')) request.finish() else: request.write(error.NoResource("Message not found").render(request)) request.finish() return ""
def xmlrpc_getLatestMessages(self, path, limit=None): """Return 'limit' latest messages delivered to this stats target, or all available recent messages if 'limit' isn't specified. """ return [(id, XML.toString(doc)) for id, doc in StatsTarget(path).messages.getLatest(limit)]
def get_source(self): return XML.toString(self.xml)
def formatItem(self, content): # Convert the root node, not the document- we don't want to # be outputting another XML declaration inside our larger document. return xml(XML.toString(content.childNodes[0]).encode('utf8'))
def parseToString(self, message): return XML.toString(self.parse(message).documentElement)