当前位置: 首页>>代码示例>>Python>>正文


Python Request.render方法代码示例

本文整理汇总了Python中twisted.web.server.Request.render方法的典型用法代码示例。如果您正苦于以下问题:Python Request.render方法的具体用法?Python Request.render怎么用?Python Request.render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.web.server.Request的用法示例。


在下文中一共展示了Request.render方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: render

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import render [as 别名]
    def render(self, resrc):
        # this is called once a Resource has been found to serve the request; in our
        # case the Resource in question will normally be a JsonResource.

        # create a LogContext for this request
        request_id = self.get_request_id()
        logcontext = self.logcontext = LoggingContext(request_id)
        logcontext.request = request_id

        # override the Server header which is set by twisted
        self.setHeader("Server", self.site.server_version_string)

        with PreserveLoggingContext(self.logcontext):
            # we start the request metrics timer here with an initial stab
            # at the servlet name. For most requests that name will be
            # JsonResource (or a subclass), and JsonResource._async_render
            # will update it once it picks a servlet.
            servlet_name = resrc.__class__.__name__
            self._started_processing(servlet_name)

            Request.render(self, resrc)

            # record the arrival of the request *after*
            # dispatching to the handler, so that the handler
            # can update the servlet name in the request
            # metrics
            requests_counter.labels(self.get_method(),
                                    self.request_metrics.name).inc()
开发者ID:DoubleMalt,项目名称:synapse,代码行数:30,代码来源:site.py

示例2: render

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import render [as 别名]
	def render(self, resource):
		"""Renders identified resource and write response"""

		CORE.info('Rendering resource...')
		try:
			body = resource.render(self)
		except NotAuthenticated:
			body = None
			self.setResponseCode(BAD_REQUEST_UNAUTH)  # HTTP FIXME
		except UnsupportedMethod:
			Request.render(self, resource)  # use twisteds error handling
			return

		if body is NOT_DONE_YET:
			return

		self.respond(body)
开发者ID:spaceone,项目名称:univention-management-console,代码行数:19,代码来源:request.py

示例3: render

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import render [as 别名]
 def render(self, resrc):
     # override the Server header which is set by twisted
     self.setHeader("Server", self.site.server_version_string)
     return Request.render(self, resrc)
开发者ID:rubo77,项目名称:synapse,代码行数:6,代码来源:site.py

示例4: render

# 需要导入模块: from twisted.web.server import Request [as 别名]
# 或者: from twisted.web.server.Request import render [as 别名]
 def render(self, resource):
     # NOTE(kgriffs): Override render, instead of process, to ensure
     #   that we have the last say in the value of the headers.
     self._inject_headers()
     Request.render(self, resource)
开发者ID:TimSimpsonR,项目名称:falcon-mutualauth,代码行数:7,代码来源:mutualauth.py


注:本文中的twisted.web.server.Request.render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。