Changes between Version 22 and Version 23 of RESTController


Ignore:
Timestamp:
11/20/09 01:39:05 (15 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RESTController

    v22 v23  
    171171{{{
    172172# Plug into REST controller
    173 jrlayer.set_method(module, 'person', None, None, 'search_simple', shn_pr_person_search_simple )
     173s3xrc.set_method(module, 'person', method='search_simple', action=shn_pr_person_search_simple )
    174174}}}
    175175
    176176Arguments of jrlayer.set_method:
    177177
    178   * '''module''' = name of the module of the primary resource
    179   * '''resource''' = name of the primary resource
    180   * '''jmodule''' = name of the module of the joined resource (if any, maybe None)
    181   * '''jresource''' = name of the joined resource (if any, maybe None)
    182   * '''method''' = name of the method
    183   * '''action''' = the function or lambda to invoke for that method (to remove a plug-in action, just pass None here)
     178  * '''module''' = prefix of the module of the primary resource
     179  * '''resource''' = name of the primary resource (without module prefix)
     180  * '''component=None''' = tablename of the component (if this method applies to a component)
     181  * '''method=None''' = name of the method
     182  * '''action=None''' = the function or lambda to invoke for that method (to remove a plug-in action, just pass None here)
    184183
    185 The action method in turn has to take plenty of arguments:
     184The action function has to take the following arguments:
    186185
    187   * '''module'''
    188   * '''resource'''
    189   * '''record_id'''
    190   * '''method'''
    191   * '''jmodule=None'''
    192   * '''jresource=None'''
    193   * '''jrecord_id=None'''
    194   * '''joinby=None'''
    195   * '''multiple=True'''
    196   * '''representation="html"'''
    197   * '''onvalidation=None'''
    198   * '''onaccept=None'''
     186  * '''jr''' = an object of the type XRequest containing all data about the request
     187  * '''onvalidation=None''' = function to called at create/update directly before writing to the database
     188  * '''onaccept=None''' = function to be called at create/update directly after writing to the database
     189
     190The onvalidation/onaccept callback functions take a dictionary as argument that contains a {{{Storage()}}} object {{{vars}}} with fieldname=value pairs. They must not be invoked when operating on component records, instead use {{{s3xml.model.get_attr(component_tablename, "onvalidation")}}} to retrieve the respective callbacks for the component.