Webb S.
unread,Nov 14, 2010, 11:42:28 PM11/14/10Sign 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-devel
In summary, one needs to give __call__ a default parameter, otherwise
the object is not recognized as a function when it is called and
throws an error. I guess I can work around by using a default of
None, but I can't believe this is desired behavior. (If you add a
default and reload, then take it away and reload, it works OK -- even
weirder.) I will file a bug report shortly, but if anyone cares to
comment, I would be interested.
Using Python 7, a recent cherrypy.
Here is some that shows the problem:
import cherrypy
class Tree(object):
def index (self):
return "Hello World"
index.exposed = True
pass
class doesntwork(object):
def __init__(self, message='not working'):
self.x = "not working"
def __call__(self,xyz):
return xyz
class worksjustfine(object):
def __init__(self, message='works'):
self.x = "wtf works"
def __call__(self,xyz='this default parameter makes it work!!'):
return xyz
Tree.doesntwork = doesntwork()
Tree.doesntwork.exposed = True
Tree.worksjustfine = worksjustfine()
Tree.worksjustfine.exposed = True
if __name__ == '__main__':
tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf')
cherrypy.quickstart(Tree(), config=tutconf)