Exemple #1
0
 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
Exemple #2
0
    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))
Exemple #3
0
 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()
Exemple #4
0
 def __init__(self):
     testutil.FakeRequest.__init__(self)
     self.d = util.Deferred()
     self.accumulator = ''