Changes between Version 49 and Version 50 of S3REST
- Timestamp:
- 07/02/10 07:54:50 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
S3REST
v49 v50 87 87 This allows you to easily make changes to resource settings (e.g. access control, list fields etc.), or even to the REST controller configuration (e.g. custom methods) depending on the request type, its parameters or the addressed resource, without having to parse the web2py request manually. You can even bypass the execution of the request and thus hook in your own REST controller - with the advantage that you don't need to parse the request anymore. 88 88 89 '''NB: Hooks should be added at the top of your controller function, especially pre-processing hooks.''' 89 '''NB: Hooks should be added at the top of your controller function (right after your resource is defined, especially pre-processing hooks. e.g.,''' 90 {{{ 91 def template(): 92 """ RESTlike CRUD controller """ 93 resource = "template" 94 def _prep(jr): 95 crud.settings.create_next = URL(r=request, f="series", args=["create"]) 96 crud.settings.update_next = URL(r=request, f="series", args=["create"]) #TODO: NB this needs to be re-worked! 97 return True 98 response.s3.prep = _prep 99 .... 100 }}} 101 90 102 91 103 A simple example: … … 95 107 if len(request.args) == 0: 96 108 # List View - reduce fields to declutter 97 table.message.readable = Fals e109 table.message.readable = Fals 98 110 table.categories.readable = False 99 111 table.verified_details.readable = False