def sendThrough(self, what): page = livepage.LivePage() handle = livepage.ClientHandle(page, 'asdf', 0, 0) ctx = makeCtx() page.rememberStuff(ctx) d = util.Deferred() handle.setOutput(ctx, d) handle.send(what) return d.result
def test_deferredProperty(self): class IDeferredProperty(formless.TypedInterface): d = formless.String() from nevow import util deferred = util.Deferred() deferred.callback('the default value') class Implementation(object): implements(IDeferredProperty) d = deferred return deferredRender(rend.Page(Implementation(), docFactory=loaders.stan(html[freeform.renderForms('original')]))).addCallback( lambda result: self.assertIn('value="the default value"', result))
def __init__(self, environ, start_response): self.environ = environ self.start_response = start_response self.outgoingHeaders = [] self.received_headers = {} self.lastModified = None self.etag = None self.method = environ.get('REQUEST_METHOD', 'GET') self.args = self._parseQuery(environ.get('QUERY_STRING', '')) try: self.host = (self.environ['REMOTE_ADDR'], int(self.environ['REMOTE_PORT'])) except KeyError: pass # TODO for k,v in environ.items(): if k.startswith('HTTP_'): self.received_headers[k[5:].lower()] = v self.setResponseCode("200") self.headersSent = False self.appRootURL = None self.deferred = util.Deferred()
def __init__(self): testutil.FakeRequest.__init__(self) self.d = util.Deferred() self.accumulator = ''