Changes between Initial Version and Version 1 of OwsFramework/Decorators


Ignore:
Timestamp:
15/01/08 10:59:09 (12 years ago)
Author:
spascoe
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OwsFramework/Decorators

    v1 v1  
     1 
     2The {{{ows_common.pylons.decorators}}} module provides a set of 
     3decorators for setting attributes of the OWS controller protocol. 
     4These are added to the beginning of operation definitions e.g.: 
     5 
     6{{{ 
     7#!python 
     8class WmsController(OwsController): 
     9 
     10    # ... 
     11 
     12    @ows_operation 
     13    @ows_parameter('Format', possibleValues=['text/xml']) 
     14    @ows_parameter('Service', possibleValues=['WMS'], required=True) 
     15    @ows_parameter('Version', possibleValues=['1.3.0']) 
     16    def GetCapabilities(self, file, service=None, version=None): 
     17        # ... 
     18}}} 
     19 
     20 {{{@ows_operation}}}:: 
     21  Should be the top-most decorator.  It wraps the method in a function that 
     22  performs request handling and type checking on the operation's arguments. 
     23 {{{@ows_parameter}}}:: 
     24  Add one of these for each operation parameter.  This instructs the framework 
     25  to perform several tasks. 
     26   1. Add the parameter (from request.params) to the list of arguments send to 
     27      the operation method. 
     28   1. Populate {{{ows_common}}} objects to describe this parameter in the 
     29      GetCapabilities document. 
     30   1. Do type-checking on the parameter's value during invocation. 
     31      The {{{possibleValues}}} argument allows you to define a set of 
     32      possible values, the {{{require}}} argument can declare an argument 
     33      required and the {{{validator}}} argument allows you to provide a 
     34      validation function. 
     35 {{{@ows_constraint}}}:: 
     36  OWS common 1.3.0 allows you to define constraints on operations.  This 
     37  decorator will populate the necessary {{{ows_common}}} objects for describing 
     38  the constraint in the GetCapabilities document.