Wiki Navigation

Positional Parameter demonstration

Any exposed method defined in your application can make use of positional parameters, although it's extremely hard to explain in text. The easiest way to get a grip on how CherryPy deals with URL to parameter mapping is to create a very simple method, fire up your application, and try some URL's.

You'll notice that the last URL will cause a 500 error. This is because the first part of the URL after /mytest (i.e. 'foo') is given as the value for param_1 and you are also passing param_1=baz using the URL parameter. Effectively you are defining param_1 twice which is just not very useful.

The conclusion to the above example is simply this: Take care when naming your method's parameters so they will not overlap with explicit keyword parameters.