本文整理汇总了Python中nevow.testutil.FakeRequest.fields方法的典型用法代码示例。如果您正苦于以下问题:Python FakeRequest.fields方法的具体用法?Python FakeRequest.fields怎么用?Python FakeRequest.fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nevow.testutil.FakeRequest
的用法示例。
在下文中一共展示了FakeRequest.fields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render2
# 需要导入模块: from nevow.testutil import FakeRequest [as 别名]
# 或者: from nevow.testutil.FakeRequest import fields [as 别名]
def render2(self, page, **kwargs):
# use this to exercise the normal Nevow docFactory rendering. It
# returns a string. If one of the render_* methods returns a
# Deferred, this will throw an exception. (note that
# page.renderString is the Deferred-returning equivalent)
req = FakeRequest(**kwargs)
req.fields = None
ctx = self.make_context(req)
return page.renderSynchronously(ctx)
示例2: render1
# 需要导入模块: from nevow.testutil import FakeRequest [as 别名]
# 或者: from nevow.testutil.FakeRequest import fields [as 别名]
def render1(self, page, **kwargs):
# use this to exercise an overridden renderHTTP, usually for
# output=json or render_GET. It always returns a Deferred.
req = FakeRequest(**kwargs)
req.fields = None
ctx = self.make_context(req)
d = defer.maybeDeferred(page.renderHTTP, ctx)
def _done(res):
if isinstance(res, str):
return res + req.v
return req.v
d.addCallback(_done)
return d