Issue #1265 resolved

inaccurate docs on creating RESTful API

created an issue

Hello, I'm a cherrypy beginner. I wanted to create a RESTful API basing on the songs example from the docs. It says:

Represents the Read method in CRUD.

Add a new method to the file, called GET:

I followed this code (adding the def GET) and added it to and I was getting 405 Method not allowed:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.2.4-py2.7.egg/cherrypy/", line 656, in respond
    response.body = self.handler()
  File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.2.4-py2.7.egg/cherrypy/lib/", line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.2.4-py2.7.egg/cherrypy/", line 386, in __call__
    raise self
HTTPError: (405, None)

It started to work after I moved the GET function from module level to Songs class level. It's not critical, but the docs here are inaccurate in my opinion. It should be Add a new method to Songs class inside the file instead of Add a new method to the file

Comments (5)

  1. Log in to comment