Voltron
unread,Oct 31, 2009, 4:22:06 AM10/31/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to cherrypy-users
Taking the example from the wiki:
import cherrypy
class Root():
exposed = True
def __init__(self, *things):
self.things = list(things)
def GET(self):
return repr(self.things)
def POST(self, thing):
self.things.append(thing)
root = Root(1, 2, 3)
d = cherrypy.dispatch.MethodDispatcher()
conf = {'/': {'request.dispatch': d}}
cherrypy.tree.mount(root, "/", conf)
cherrypy.server.socket_port=8081
cherrypy.quickstart(root)
This fails with a traceback:
Traceback (most recent call last):
File "C:\Python26\lib\site-packages\cherrypy\_cprequest.py", line
606, in respond
cherrypy.response.body = self.handler()
File "C:\Python26\lib\site-packages\cherrypy\_cpdispatch.py", line
25, in __call__
return self.callable(*self.args, **self.kwargs)
AttributeError: Root instance has no __call__ method
Can someone tell me what I have done wrong? Thanks