Hi,
I have an api.py module which is the interface to my restful api. Currently
I have to do the following to extend my api:
def common(obj):
response.view = 'generic.json'
response.headers['Content-Type'] = CONTENT_TYPE_JSON
def GET(*args,**vars):
return api_router(API_GET, obj, *args, **vars)
def POST(*args,**vars):
return api_router(API_POST, obj, *args, **vars)
def PUT(*args,**vars):
return api_router(API_PUT, obj, *args, **vars)
def DELETE(*args, **vars):
return api_router(API_DELETE, obj, *args, **vars)
return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)
@request.restful()
def index():
return common('root')
@request.restful()
def nodes():
return common('nodes')
@request.restful()
def agents():
return common('agents')
...
For any new object that I want to offer via my api, I need to list it as
@request.restful funcion, and link to common (the common api
implementation). I would like to define this common function as the
"catch-all" restful function for my api. My api_router already knows which
objects are supported, and replies with 404 if a requested object is not
supported, so it makes no sense for me to be forced to do this again on the
controller.
How can I define this "catch-all" function in my api controller?
Thanks,
Daniel
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.