本文整理汇总了Python中twisted.web.server.Request.finish方法的典型用法代码示例。如果您正苦于以下问题:Python Request.finish方法的具体用法?Python Request.finish怎么用?Python Request.finish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.web.server.Request
的用法示例。
在下文中一共展示了Request.finish方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: finish
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import finish [as 别名]
def finish(self):
"""Called when all response data has been written to this Request.
Overrides twisted.web.server.Request.finish to record the finish time and do
logging.
"""
self.finish_time = time.time()
Request.finish(self)
if not self._is_processing:
with PreserveLoggingContext(self.logcontext):
self._finished_processing()
示例2: finish
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import finish [as 别名]
def finish(self):
"""
Event received when the request is finished,
for WebsocketTransport only.
Pass that event to the transport, for processing extensions.
"""
if self.transport.__class__ == WebsocketTransport:
self.transport.finish()
if not self._disconnected:
## FIXME: use notifyFinished?
Request.finish(self)
示例3: finish
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import finish [as 别名]
def finish( self ):
Request.finish( self )
host = self.getHost()
status_text = '200'
if self.hydrus_response_context is not None:
status_text = HydrusData.ToUnicode( self.hydrus_response_context.GetStatusCode() )
message = str( host.port ) + ' ' + HydrusData.ToUnicode( self.method ) + ' ' + HydrusData.ToUnicode( self.path ) + ' ' + status_text + ' in ' + HydrusData.ConvertTimeDeltaToPrettyString( time.clock() - self.start_time )
HydrusData.Print( message )
示例4: finish
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import finish [as 别名]
def finish(self):
rv = Request.finish(self)
# Some requests, like those for static files, don't have store
store = getattr(self, 'store', None)
if store:
# Roll back and then commit, so that no transaction
# is left open between requests.
store.rollback()
store.commit()
# Some use cases involve setting store.request in
# getRequestStore, so remove request.store here to
# avoid a circular reference GC.
del self.store
return rv
示例5: finish
# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import finish [as 别名]
def finish(self):
rv = Request.finish(self)
store.rollback()
store.commit()
return rv