本文整理汇总了Python中nevow.inevow.IRequest.isSecure方法的典型用法代码示例。如果您正苦于以下问题:Python IRequest.isSecure方法的具体用法?Python IRequest.isSecure怎么用?Python IRequest.isSecure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nevow.inevow.IRequest
的用法示例。
在下文中一共展示了IRequest.isSecure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: locateChild
# 需要导入模块: from nevow.inevow import IRequest [as 别名]
# 或者: from nevow.inevow.IRequest import isSecure [as 别名]
def locateChild(self, context, segments):
"""
Unwrap the wrapped resource if HTTPS is already being used, otherwise
wrap it in a helper which will preserve the wrapping all the way down
to the final resource.
"""
request = IRequest(context)
if request.isSecure():
return self.wrappedResource, segments
return _SecureWrapper(self.urlGenerator, self.wrappedResource), segments
示例2: renderHTTP
# 需要导入模块: from nevow.inevow import IRequest [as 别名]
# 或者: from nevow.inevow.IRequest import isSecure [as 别名]
def renderHTTP(self, context):
"""
Render the wrapped resource if HTTPS is already being used, otherwise
invoke a helper which may generate a redirect.
"""
request = IRequest(context)
if request.isSecure():
renderer = self.wrappedResource
else:
renderer = _SecureWrapper(self.urlGenerator, self.wrappedResource)
return renderer.renderHTTP(context)