Changes between Version 30 and Version 31 of S3/S3REST/s3_rest_controller

10/24/10 05:51:55 (14 years ago)
Dominic König



  • S3/S3REST/s3_rest_controller

    v30 v31  
    6767=== Callbacks ===
     69For every DB table, you can define functions to be invoked upon certain CRUD events. Those "callbacks" can be:
     71  - a single callable (function, lambda, callable object)
     72  - a list of callables, which are invoked in list order
     73  - a dict of callables, where the tablename is used as key to find the callable to be invoked
     74  - a dict of lists of callables, where the tablename is used as key to find the list of callables to be executed in list order
     76The return value of the callables, if any, is ignored.
     78==== Validation Callbacks ====
     80After successful submission of a create/update form (=the input data have successfully passed the field validation), you can define extra form validation methods to be invoked by using:
     83s3xrc.model.configure(table, create_onvalidation=callback)
     86s3xrc.model.configure(table, update_onvalidation=callback)
     91  - '''table''' is the respective DB table
     92  - '''callable''' is the callback setting, see [#Callbacks Callbacks]
     94If either of {{{create_onvalidation}}} or {{{update_onvalidation}}} is not set, then the {{{onvalidation}}} setting is tried:
     97s3xrc.model.configure(table, onvalidation=callback)
     100This allows you to define a common onvalidation callback for both ''create'' and ''update''.
     102Onvalidation callbacks are meant to allow form data validation, where any validation errors are to be put directly into the form as:
     105form.errors[fieldname] = error_msg
     110  - '''fieldname''' is the field containing the invalid value
     111  - '''error_msg''' is the error message to be displayed in the form close to that field
     113The callables receive the form as first and only parameter, and their return values will be ignored.
     116  On-validation callbacks are also invoked in non-interactive data imports, where multiple records are being processed in one and the same request. Therefore the callback '''must not redirect'''!
     118==== On-accept Callbacks ====
     120==== On-Delete Callback ====
    69121=== Pagination ===