Package gavo :: Package protocols :: Module dlasync :: Class FakeRequest
[frames] | no frames]

Class FakeRequest

source code

twisted.python.components.Componentized --+        
                                          |        
                 nevow.testutil.FakeRequest --+    
                                              |    
         nevow.testutil.AccumulatingFakeRequest --+
                                                  |
                                                 FakeRequest

A nevow Request for local data accumulation.

We have a version of our own for this since nevow's has a registerProducer that produces an endless loop with push producers (which is what we have).

Instance Methods
 
__init__(self, destFile, *args, **kwargs)
Create a FakeRequest instance.
source code
 
write(self, stuff)
Accumulate the given bytes as part of the response body.
source code
 
registerProducer(self, producer, isPush)
Synchronously cause the given producer to produce all of its data.
source code
 
unregisterProducer(self) source code
 
notifyFinish(self) source code

Inherited from nevow.testutil.AccumulatingFakeRequest: __provides__, getDefault, remember

Inherited from nevow.testutil.FakeRequest: URLPath, addCookie, finish, finishRequest, getClientIP, getCookie, getHeader, getPassword, getRootURL, getSession, getUser, isSecure, prePathURL, processingFailed, redirect, rememberRootURL, setHeader, setLastModified, setResponseCode

Inherited from twisted.python.components.Componentized: __conform__, __providedBy__, addAdapter, addComponent, getComponent, locateAdapterClass, removeComponent, setAdapter, setComponent, unsetComponent

Class Variables

Inherited from nevow.testutil.AccumulatingFakeRequest: __implemented__

Inherited from nevow.testutil.FakeRequest: code, content, context, failure, fields, finished, method, redirected_to

Inherited from twisted.python.components.Componentized: persistenceVersion

Instance Variables

Inherited from nevow.testutil.FakeRequest: accumulator, deferred, lastModified

Properties

Inherited from nevow.testutil.FakeRequest: headers, received_headers, v

Method Details

__init__(self, destFile, *args, **kwargs)
(Constructor)

source code 

Create a FakeRequest instance.

Parameters:
  • headers - dict of request headers
  • args - dict of args
  • avatar - avatar to pass to the FakeSession instance
  • uri - request URI
  • currentSegments - list of segments that have "already been located"
  • cookies - dict of cookies
  • user - username (like in http auth)
  • password - password (like in http auth)
  • isSecure - whether this request represents an HTTPS url
Overrides: twisted.python.components.Componentized.__init__

write(self, stuff)

source code 

Accumulate the given bytes as part of the response body.

Overrides: nevow.testutil.FakeRequest.write
(inherited documentation)

registerProducer(self, producer, isPush)

source code 

Synchronously cause the given producer to produce all of its data.

This will not work with push producers. Do not use it with them.

Overrides: nevow.testutil.FakeRequest.registerProducer
(inherited documentation)