Package madrona :: Package manipulators :: Module manipulators :: Class BaseManipulator
[hide private]

Class BaseManipulator

source code

object --+
         |
        BaseManipulator


BaseManipulator should be used as the parent class to all manipulator classes.
The manipulate() function should be overridden with suitable definition, it is this function that will
    be called automatically when your manipulator class is included in the Mpa.Options.manipulators list.
    This function generally takes as input a target shape geometry, and should return a call to result() 
    containing the 'clipped_shape' and optionally a rendered template 'html' and 'success' value.
    'clipped_shape' is the new shape as a result of the manipulator
    'html' is generally a template that might be displayed by the client
    'success' is a signal, '1' or '0', as to whether the manipulation succeeded or not
The do_template() function can be used to render a template with appropriate context
The target_to_valid_geom() function can be used to generate a geometry from target shape
The result() function should be used for the manipulator return value to ensure that all necessary
    key/value pairs are provided.
Three useful exceptions are provided as well:
    InternalException is used for exceptions or errors that are considered 'server-side' 
        or 'out of the users control', such as failed database access, or failed geometry operation.
    InvalidGeometryException is used for exceptions or errors resulting from an innapropriate mpa geometry 
        such as a point, line, or otherwise invalid geometry.
    HaltManipulations is used for errors, not already handled by InternalException or InvalidGeometryException,
        that should prevent any further manipulations from taking place. This could be useful in cases such as
        when an mpa geometry is outside of the study region. In such cases there is no need for further 
        manipulations as such an mpa entry is already deemed inappropriate for our use.

Nested Classes [hide private]
  Form
  Options
  InternalException
  InvalidGeometryException
  HaltManipulations
Instance Methods [hide private]
 
__init__(self, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
manipulate(self) source code
 
do_template(self, key, internal_message='', extra_context={}) source code
 
target_to_valid_geom(self, shape) source code
 
result(self, clipped_shape, html="", success="1") source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **kwargs)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)