[Twisted-web] failure with simple use of registry

Dickon Reed dickon.reed at gmail.com
Mon Jun 13 08:11:17 MDT 2005


I downloaded and install twisted web today. Good documentation; told me 
exactly what I wanted to know.

However I hit a problem with using the registry though, and I reduced it to 
a simple test case:

from twisted.web.resource import Resource

class Counter:
def __init__(self):
self.x = 0
def ping(self):
self.x += 1
return self.x

counter = registry.getComponent(Counter)
if not counter:
counter = Counter()

class MyResource(Resource):
def render_GET(self, request):
return '<HTML>'+`counter`+'</HTML>'

When I view this through a web server I get a nicely formatted backtrace for 
an attribute error for '__adapt__' in my Counter class when I call 

I'm using Red Hat Linux 9, python 2.4.1, Twisted 2.0.1, ZopeInterface 3.0.1, 
and TwistedWeb 0.5.0.

Any ideas what I'm doing wrong, or do I have version skew in the Twisted Web 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20050613/6dd1f03d/attachment.htm

More information about the Twisted-web mailing list