Changes between Version 6 and Version 7 of S3REST


Ignore:
Timestamp:
03/01/10 01:14:23 (12 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • S3REST

    v6 v7  
    1010s3rest is an instance of the RESTController class, implemented in modules/s3rest.py.
    1111
     12=== Method Handlers ===
     13
     14The default method handlers for each of CRUD+S are implemented in models/01_RESTlike_controller.py:
     15
     16  - shn_read(jr, **attr)
     17  - shn_list(jr, **attr)
     18  - shn_create(jr, **attr)
     19  - shn_update(jr, **attr)
     20  - shn_delete(jr, **attr)
     21  - shn_search(jr, **attr)
     22  - shn_options(jr, **attr)
     23  - import_xml(jr, **attr)
     24  - import_json(jr, **attr)
     25
     26where ''jr'' is the current ''XRequest'', and ''**attr'' contains all further arguments passed to the REST controller.
     27
     28You can override these defaults at any time by
     29{{{
     30s3rest.set_handler(action, handler)
     31}}
     32where:
     33
     34  - '''action''' is the name of the action, i.e. one of 'read', 'list', 'create', 'update', 'delete', 'search', 'options', 'import_xml' or 'import_json'
     35  - '''handler''' is the handler function/lambda
     36
     37=== Custom Methods ===
     38
     39You can also add resource-specific custom actions by:
     40{{{
     41  s3xrc.model.set_method(module, resource, method, action)
     42}}}
     43where:
     44
     45  - '''module''' is the module prefix of a resource
     46  - '''resource''' is the name of the resource (without prefix)
     47  - '''method''' is a string representing the name of the method (e.g. "search_simple")
     48  - '''action''' is the method handler function/lambda
     49
     50The ''action'' method has to take the same arguments as the default handlers: ''jr'' (XRequest) and ''**attr''.
    1251== XRequest ==
    1352