本文整理汇总了Python中twisted.web.server.Request.processingFailed方法的典型用法代码示例。如果您正苦于以下问题:Python Request.processingFailed方法的具体用法?Python Request.processingFailed怎么用?Python Request.processingFailed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.web.server.Request
的用法示例。
在下文中一共展示了Request.processingFailed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: processingFailed
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import processingFailed [as 别名]
def processingFailed(self, reason):
if self.is_ajax():
log.err(reason)
if self.site.displayTracebacks:
body = reason.getTraceback()
else:
body = b"Processing Failed"
self.setResponseCode(http.INTERNAL_SERVER_ERROR)
self.setHeader(b'content-type', b"text/plain")
self.setHeader(b'content-length', intToBytes(len(body)))
self.write(body)
self.finish()
return reason
return WebRequest.processingFailed(self, reason)
示例2: processingFailed
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import processingFailed [as 别名]
def processingFailed(self, reason):
if DEBUG:
return Request.processingFailed(self, reason)
else:
if issubclass(reason.type, YuzukiException):
exc = reason.value
self.logger.warning(reason)
self.setResponseCode(exc.status)
body = generate_error_message(self, exc.status, exc.message)
else:
self.logger.error(reason)
self.setResponseCode(INTERNAL_SERVER_ERROR)
body = generate_error_message(self, INTERNAL_SERVER_ERROR, u"서버 에러가 발생하였습니다.")
if issubclass(reason.type, SQLAlchemyError):
YuzukiRequest.dbsession.close()
YuzukiRequest.dbsession = DatabaseHelper.session()
body = body.encode("UTF-8")
self.setHeader(b'content-type', b"text/html")
self.setHeader(b'content-length', intToBytes(len(body)))
self.write(body)
self.finish()
return reason
示例3: processingFailed
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import processingFailed [as 别名]
def processingFailed(self, reason):
rv = Request.processingFailed(self, reason)
store.rollback()
store.commit()
return rv