Changes between Version 52 and Version 53 of DeveloperGuidelinesS3Framework


Ignore:
Timestamp:
09/12/10 10:17:35 (11 years ago)
Author:
Fran Boon
Comment:

Redirection should never be done in Validators, Onaccept or Onvalidation routines

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelinesS3Framework

    v52 v53  
    6363 * [wiki:DeveloperGuidelinesDatabaseSynchronization Database Synchronization]
    6464
     65=== Redirection ===
     66Remember that the interactive HTML interface is just one way to access the system. Non-interactive interfaces like Synchronization are also common, as are background interactions like AJAX.
     67
     68Therefore be very wary of using Redirection, which should '''never''' be done in Validators, Onaccept or Onvalidation routines & should be done within REST Controllers only with a check:
     69{{{
     70def my_resource():
     71    """ REST Controller for my_resource """
     72
     73    def prep(r):
     74        if r.representation in shn_interactive_formats
     75            redirect ok
     76        ...
     77}}}
    6578== Optional ==
    6679Other reusable fields are available to add Foreign Key links to key tables, such as 'location_id' to add a GIS location for Mapping, 'person_id' to add a Person & 'organisation_id' to add a link to an Organisation.