Changes between Version 45 and Version 46 of RESTController


Ignore:
Timestamp:
06/11/10 20:50:05 (12 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RESTController

    v45 v46  
    173173The following disables the create method for a resource
    174174{{{
    175 def restricted_method(*arguments, **keywords):                                                                               
     175def restricted_method(jr, **attr):                                                                               
    176176    """Handy function for restricting access to certain methods """                                                           
    177177    session.error = T("Restricted method")                                                                                   
     
    188188}}}
    189189
    190 
    191190Arguments of {{{set_method}}}:
    192191
     
    200199
    201200  * '''jr''' = an instance of ''S3RESTRequest'' containing all data about the request
    202   * '''onvalidation=None''' = function to be called at create/update directly before writing to the database
    203   * '''onaccept=None''' = function to be called at create/update directly after writing to the database
    204 
    205 The onvalidation/onaccept callback functions in turn take a dictionary as argument that contains a {{{Storage()}}} object {{{vars}}} with fieldname=value pairs. They are to be called on create/update actions on the primary resource, while 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 table.
     201  * '''**attr''' = a dictionary of named arguments (same named args as passed to the shn_rest_controller)