Issue #655 resolved

Config file parser doesn't properly handle function calls

Anonymous created an issue

For illustration, using the following config directive

{{{ [/] request.dispatch = cherrypy.dispatch.Dispatcher() }}}

Throws the following stack trace:

{{{ ... File "/home/derekl/python-packages/cherrypy/", line 225, in update config = _Parser().dict_from_file(config) File "/home/derekl/python-packages/cherrypy/", line 298, in dict_from_file return self.as_dict() File "/home/derekl/python-packages/cherrypy/", line 289, in as_dict raise ValueError(msg,, x.args) ValueError: ("Config error in section: '/', option: 'request.dispatch', value: 'cherrypy.dispatch.Dispatcher()'", 'ValueError', ('need more than 3 values to unpack',)) }}}

The problem exists in the _builder.build_CallFunc method in lib/ which assumes that CallFunc.getChildren() returns a 4 length list or tuple when in fact it returns a variable length list. This list has the following structure: * Function object * Flattened list of arguments (this is where the variable length comes from) * Star args list (not flattened) * Keyword args (dictionary, probably)

Currently the config parser does properly handle functions with one argument. I'll try to attach a patch.

Reported by dezl

Comments (2)

  1. Log in to comment