Reputation: 1879
I'm using cherrypy to mimic an existing RESTful interface. One requirement is that I have is to be able to add objects on the fly.
So, for example, let's say I have an object, called myobj. I want to be able to expose a method that is based on an object added by the user. So, I would have an "add" context, where I create the object
http://example.ex/myobj+create
and I would be able to retrieve the object that's created, as well as any children:
http://example.ex/myobjs/obj1
http://example.ex/myobjs/obj1/child1
Is this possible with cherrypy? Should I be investigating a different framework?
Upvotes: 2
Views: 368
Reputation: 14559
Yes, you can add handlers dynamically. Just execute obj1.child1 = Child(...)
.
Upvotes: 0
Reputation: 851
You probably want to look at the _cp_dispatch or popargs facilities that CherryPy 3.2+ offers. They are less known and unfortunately I couldn't find proper doc for them but they would do what you're after. Alternatively, you could use the Routes or selector dispatchers.
Upvotes: 1
Reputation: 2685
CherryPy 3.2 (REST) provides an interface for creating RESTful interfaces.
Upvotes: 0