def sendoutput(self, result):
content = result.read()
logger.debug(content)
if result.status == 200:
web.ctx.headers = result.getheaders()
if len(content.strip()) > 0:
d = self.parse_response(content)
err = d.find('err')
if err is not None:
reason = '%s %s' % (err.attrib['code'], err.attrib['msg'])
response = {'error': reason}
web.ctx.status = str(400)+' '+reason
else:
response = {'id': d.findtext('statusid')}
content = simplejson.dumps(response)
filtered = self.filter(content)
web.header('content-length', len(filtered))
return filtered
else:
web.ctx.headers = result.getheaders()
web.ctx.status = str(result.status)+' '+result.reason
return content
评论列表
文章目录