[Twisted-Python] IResource and http.Site()

Jon Parise jon at csh.rit.edu
Mon Aug 14 22:19:27 EDT 2006


I'm relatively new to Twisted, so apologies if I'm missing something
obvious.  I'm using Twisted 2.4, and I'm trying to use twisted.web with 
my own resource implementation.

It looks like my options are to either derive from http.Resource or 
implement the http.IResource interface directly.  I've decided to start 
with the latter.

The IResource interface declares three methods:

	getChildWithDefault(self, name, request)
	putChild(self, path, child)
	render(self, request)

However, parts of http.Site() (such as getResourceFor()) expect my 
object to offer additional methods (such as getChildForRequest()) which 
are not part of the interface.

My question is therefore: Is http.Site() only compatible with Resource 
(and not IResource), or should the IResource interface include some 
additional methods, such as getChildForRequest()?

Thanks!

-- 
Jon Parise (jon of csh.rit.edu)  ::  http://www.csh.rit.edu/~jon/




More information about the Twisted-Python mailing list