cwt.wps_lib package

Submodules

cwt.wps_lib.metadata module

class cwt.wps_lib.metadata.AllowedValues(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
elements = {'range': <cwt.wps_lib.xml.Element object>, 'value': <cwt.wps_lib.xml.Element object>}
range
store_value = None
value
class cwt.wps_lib.metadata.AnyValue(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
elements = {}
store_value = None
class cwt.wps_lib.metadata.BoundingBoxData(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
crs
dimensions
elements = {'upper_corner': <cwt.wps_lib.xml.Element object>, 'crs': <cwt.wps_lib.xml.Element object>, 'dimensions': <cwt.wps_lib.xml.Element object>, 'lower_corner': <cwt.wps_lib.xml.Element object>}
lower_corner
store_value = None
upper_corner
class cwt.wps_lib.metadata.BoundingBoxDataDescription(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
default
elements = {'default': <cwt.wps_lib.xml.Element object>, 'supported': <cwt.wps_lib.xml.Element object>}
store_value = None
supported
class cwt.wps_lib.metadata.ComplexData(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'schema': <cwt.wps_lib.xml.Attribute object>, 'mime_type': <cwt.wps_lib.xml.Attribute object>, 'encoding': <cwt.wps_lib.xml.Attribute object>}
elements = {'value': <cwt.wps_lib.xml.Element object>}
encoding
mime_type
schema
store_value = 'value'
value
class cwt.wps_lib.metadata.ComplexDataDescription(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'maximum_megabytes': <cwt.wps_lib.xml.Attribute object>}
default
elements = {'default': <cwt.wps_lib.xml.Element object>, 'supported': <cwt.wps_lib.xml.Element object>}
maximum_megabytes
store_value = None
supported
class cwt.wps_lib.metadata.Exception(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'locator': <cwt.wps_lib.xml.Attribute object>, 'exception_code': <cwt.wps_lib.xml.Attribute object>}
elements = {'exception_text': <cwt.wps_lib.xml.Element object>}
exception_code
exception_text
locator
store_value = None
class cwt.wps_lib.metadata.ExceptionReport(version=None)

Bases: cwt.wps_lib.xml.XMLDocument

add_exception(ex_code, msg, locator=None)
attributes = {'version': <cwt.wps_lib.xml.Attribute object>}
elements = {'exception': <cwt.wps_lib.xml.Element object>}
exception
store_value = None
version
class cwt.wps_lib.metadata.Format(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
elements = {'schema': <cwt.wps_lib.xml.Element object>, 'mime_type': <cwt.wps_lib.xml.Element object>, 'encoding': <cwt.wps_lib.xml.Element object>}
encoding
mime_type
schema
store_value = None
class cwt.wps_lib.metadata.Input(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

abstract
attributes = {}
data
elements = {'abstract': <cwt.wps_lib.xml.Element object>, 'identifier': <cwt.wps_lib.xml.Element object>, 'data': <cwt.wps_lib.xml.Element object>, 'title': <cwt.wps_lib.xml.Element object>}
identifier
store_value = None
title
class cwt.wps_lib.metadata.InputDescription(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

abstract
attributes = {'max_occurs': <cwt.wps_lib.xml.Attribute object>, 'min_occurs': <cwt.wps_lib.xml.Attribute object>}
elements = {'abstract': <cwt.wps_lib.xml.Element object>, 'identifier': <cwt.wps_lib.xml.Element object>, 'metadata': <cwt.wps_lib.xml.Element object>, 'value': <cwt.wps_lib.xml.Element object>, 'title': <cwt.wps_lib.xml.Element object>}
identifier
max_occurs
metadata
min_occurs
store_value = None
title
value
class cwt.wps_lib.metadata.Languages(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
default
elements = {'default': <cwt.wps_lib.xml.Element object>, 'supported': <cwt.wps_lib.xml.Element object>}
store_value = None
supported
class cwt.wps_lib.metadata.LiteralData(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'uom': <cwt.wps_lib.xml.Attribute object>, 'data_type': <cwt.wps_lib.xml.Attribute object>}
data_type
elements = {'value': <cwt.wps_lib.xml.Element object>}
store_value = 'value'
uom
value
class cwt.wps_lib.metadata.LiteralDataDescription(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
data_type
default_value
elements = {'uoms': <cwt.wps_lib.xml.Element object>, 'default_value': <cwt.wps_lib.xml.Element object>, 'value': <cwt.wps_lib.xml.Element object>, 'data_type': <cwt.wps_lib.xml.Element object>}
store_value = None
uoms
value
class cwt.wps_lib.metadata.Operation(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'name': <cwt.wps_lib.xml.Attribute object>}
elements = {'post': <cwt.wps_lib.xml.Element object>, 'get': <cwt.wps_lib.xml.Element object>}
get
name
post
store_value = None
class cwt.wps_lib.metadata.Output(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

abstract
attributes = {}
data
elements = {'abstract': <cwt.wps_lib.xml.Element object>, 'identifier': <cwt.wps_lib.xml.Element object>, 'data': <cwt.wps_lib.xml.Element object>, 'reference': <cwt.wps_lib.xml.Element object>, 'title': <cwt.wps_lib.xml.Element object>}
identifier
reference
store_value = None
title
class cwt.wps_lib.metadata.OutputDefinitions(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

abstract
attributes = {'reference': <cwt.wps_lib.xml.Attribute object>}
elements = {'title': <cwt.wps_lib.xml.Element object>, 'abstract': <cwt.wps_lib.xml.Element object>, 'encoding': <cwt.wps_lib.xml.Element object>, 'uom': <cwt.wps_lib.xml.Element object>, 'identifier': <cwt.wps_lib.xml.Element object>, 'mime_type': <cwt.wps_lib.xml.Element object>, 'schema': <cwt.wps_lib.xml.Element object>}
encoding
identifier
mime_type
reference
schema
store_value = None
title
uom
class cwt.wps_lib.metadata.OutputDescription(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

abstract
attributes = {}
elements = {'abstract': <cwt.wps_lib.xml.Element object>, 'identifier': <cwt.wps_lib.xml.Element object>, 'metadata': <cwt.wps_lib.xml.Element object>, 'value': <cwt.wps_lib.xml.Element object>, 'title': <cwt.wps_lib.xml.Element object>}
identifier
metadata
store_value = None
title
value
class cwt.wps_lib.metadata.Process(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

abstract
attributes = {'process_version': <cwt.wps_lib.xml.Attribute object>}
elements = {'profile': <cwt.wps_lib.xml.Element object>, 'title': <cwt.wps_lib.xml.Element object>, 'abstract': <cwt.wps_lib.xml.Element object>, 'wsdl': <cwt.wps_lib.xml.Element object>, 'identifier': <cwt.wps_lib.xml.Element object>, 'metadata': <cwt.wps_lib.xml.Element object>}
identifier
metadata
process_version
profile
store_value = None
title
wsdl
class cwt.wps_lib.metadata.ProcessAccepted(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
elements = {}
store_value = None
class cwt.wps_lib.metadata.ProcessDescription(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

abstract
attributes = {'process_version': <cwt.wps_lib.xml.Attribute object>, 'status_supported': <cwt.wps_lib.xml.Attribute object>, 'store_supported': <cwt.wps_lib.xml.Attribute object>}
elements = {'profile': <cwt.wps_lib.xml.Element object>, 'title': <cwt.wps_lib.xml.Element object>, 'abstract': <cwt.wps_lib.xml.Element object>, 'input': <cwt.wps_lib.xml.Element object>, 'output': <cwt.wps_lib.xml.Element object>, 'wsdl': <cwt.wps_lib.xml.Element object>, 'identifier': <cwt.wps_lib.xml.Element object>, 'metadata': <cwt.wps_lib.xml.Element object>}
identifier
input
metadata
output
process_version
profile
status_supported
store_supported
store_value = None
title
wsdl
class cwt.wps_lib.metadata.ProcessFailed(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
elements = {'exception_report': <cwt.wps_lib.xml.Element object>}
exception_report
store_value = None
class cwt.wps_lib.metadata.ProcessPaused(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
elements = {}
store_value = None
class cwt.wps_lib.metadata.ProcessStarted(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'percent_completed': <cwt.wps_lib.xml.Attribute object>}
elements = {'value': <cwt.wps_lib.xml.Element object>}
percent_completed
store_value = 'value'
value
class cwt.wps_lib.metadata.ProcessSucceeded(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
elements = {}
store_value = None
class cwt.wps_lib.metadata.Range(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
elements = {'range_closure': <cwt.wps_lib.xml.Element object>, 'spacing': <cwt.wps_lib.xml.Element object>, 'maximum_value': <cwt.wps_lib.xml.Element object>, 'minimum_value': <cwt.wps_lib.xml.Element object>}
maximum_value
minimum_value
range_closure
spacing
store_value = None
class cwt.wps_lib.metadata.RawDataOutput(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
elements = {'schema': <cwt.wps_lib.xml.Element object>, 'identifier': <cwt.wps_lib.xml.Element object>, 'mime_type': <cwt.wps_lib.xml.Element object>, 'uom': <cwt.wps_lib.xml.Element object>, 'encoding': <cwt.wps_lib.xml.Element object>}
encoding
identifier
mime_type
schema
store_value = None
uom
class cwt.wps_lib.metadata.Reference(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'schema': <cwt.wps_lib.xml.Attribute object>, 'mime_type': <cwt.wps_lib.xml.Attribute object>, 'encoding': <cwt.wps_lib.xml.Attribute object>}
body
body_reference
elements = {'body': <cwt.wps_lib.xml.Element object>, 'header': <cwt.wps_lib.xml.Element object>, 'href': <cwt.wps_lib.xml.Element object>, 'body_reference': <cwt.wps_lib.xml.Element object>, 'method': <cwt.wps_lib.xml.Element object>}
encoding
header
href
method
mime_type
schema
store_value = None
class cwt.wps_lib.metadata.ResponseDocument(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'lineage': <cwt.wps_lib.xml.Attribute object>, 'status': <cwt.wps_lib.xml.Attribute object>, 'store_execute_resposne': <cwt.wps_lib.xml.Attribute object>}
elements = {'output': <cwt.wps_lib.xml.Element object>}
lineage
output
status
store_execute_resposne
store_value = None
class cwt.wps_lib.metadata.ServiceContact(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

administrative_area
attributes = {}
city
country
delivery_point
electronic_mail_address
elements = {'city': <cwt.wps_lib.xml.Element object>, 'administrative_area': <cwt.wps_lib.xml.Element object>, 'country': <cwt.wps_lib.xml.Element object>, 'individual_name': <cwt.wps_lib.xml.Element object>, 'facsimile': <cwt.wps_lib.xml.Element object>, 'delivery_point': <cwt.wps_lib.xml.Element object>, 'position_name': <cwt.wps_lib.xml.Element object>, 'postal_code': <cwt.wps_lib.xml.Element object>, 'voice': <cwt.wps_lib.xml.Element object>, 'electronic_mail_address': <cwt.wps_lib.xml.Element object>}
facsimile
individual_name
position_name
postal_code
store_value = None
voice
class cwt.wps_lib.metadata.ServiceIdentification(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

abstract
access_constraints
attributes = {}
elements = {'profile': <cwt.wps_lib.xml.Element object>, 'service_type_version': <cwt.wps_lib.xml.Element object>, 'title': <cwt.wps_lib.xml.Element object>, 'abstract': <cwt.wps_lib.xml.Element object>, 'service_type': <cwt.wps_lib.xml.Element object>, 'fees': <cwt.wps_lib.xml.Element object>, 'keywords': <cwt.wps_lib.xml.Element object>, 'access_constraints': <cwt.wps_lib.xml.Element object>}
fees
keywords
profile
service_type
service_type_version
store_value = None
title
class cwt.wps_lib.metadata.ServiceProvider(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
elements = {'provider_site': <cwt.wps_lib.xml.Element object>, 'provider_name': <cwt.wps_lib.xml.Element object>, 'service_contact': <cwt.wps_lib.xml.Element object>}
provider_name
provider_site
service_contact
store_value = None
class cwt.wps_lib.metadata.UOMS(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
default
elements = {'default': <cwt.wps_lib.xml.Element object>, 'supported': <cwt.wps_lib.xml.Element object>}
store_value = None
supported
class cwt.wps_lib.metadata.ValuesReference(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
elements = {'values_form': <cwt.wps_lib.xml.Element object>, 'reference': <cwt.wps_lib.xml.Element object>}
reference
store_value = None
values_form
class cwt.wps_lib.metadata.WPSTranslator

Bases: cwt.wps_lib.xml.Translator

attribute_to_property(name)
element_to_property(name)
property_to_attribute(name)
property_to_element(name)

cwt.wps_lib.namespace module

cwt.wps_lib.namespace.tag(tag, namespace)

cwt.wps_lib.operations module

class cwt.wps_lib.operations.DescribeProcessRequest(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'version': <cwt.wps_lib.xml.Attribute object>, 'language': <cwt.wps_lib.xml.Attribute object>, 'service': <cwt.wps_lib.xml.Attribute object>}
elements = {'identifier': <cwt.wps_lib.xml.Element object>}
identifier
language
service
store_value = None
version
class cwt.wps_lib.operations.DescribeProcessResponse(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'lang': <cwt.wps_lib.xml.Attribute object>, 'version': <cwt.wps_lib.xml.Attribute object>, 'service': <cwt.wps_lib.xml.Attribute object>}
elements = {'process_description': <cwt.wps_lib.xml.Element object>}
lang
process_description
service
store_value = None
version
class cwt.wps_lib.operations.ExecuteRequest(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'version': <cwt.wps_lib.xml.Attribute object>, 'service': <cwt.wps_lib.xml.Attribute object>, 'language': <cwt.wps_lib.xml.Attribute object>}
data_inputs
elements = {'data_inputs': <cwt.wps_lib.xml.Element object>, 'identifier': <cwt.wps_lib.xml.Element object>, 'response_form': <cwt.wps_lib.xml.Element object>}
identifier
language
response_form
service
store_value = None
version
class cwt.wps_lib.operations.ExecuteResponse(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

add_output(output)
attributes = {'lang': <cwt.wps_lib.xml.Attribute object>, 'service_instance': <cwt.wps_lib.xml.Attribute object>, 'service': <cwt.wps_lib.xml.Attribute object>, 'creation_time': <cwt.wps_lib.xml.Attribute object>, 'status_location': <cwt.wps_lib.xml.Attribute object>, 'version': <cwt.wps_lib.xml.Attribute object>}
creation_time
data_inputs
elements = {'status': <cwt.wps_lib.xml.Element object>, 'process': <cwt.wps_lib.xml.Element object>, 'data_inputs': <cwt.wps_lib.xml.Element object>, 'output_definitions': <cwt.wps_lib.xml.Element object>, 'output': <cwt.wps_lib.xml.Element object>}
lang
output
output_definitions
process
service
service_instance
status
status_location
store_value = None
version
class cwt.wps_lib.operations.GetCapabilitiesRequest(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'schema_location': <cwt.wps_lib.xml.Attribute object>, 'language': <cwt.wps_lib.xml.Attribute object>, 'service': <cwt.wps_lib.xml.Attribute object>}
elements = {'version': <cwt.wps_lib.xml.Element object>}
language
schema_location
service
store_value = None
version
class cwt.wps_lib.operations.GetCapabilitiesResponse(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'lang': <cwt.wps_lib.xml.Attribute object>, 'version': <cwt.wps_lib.xml.Attribute object>, 'update_sequence': <cwt.wps_lib.xml.Attribute object>, 'service': <cwt.wps_lib.xml.Attribute object>}
elements = {'service_identification': <cwt.wps_lib.xml.Element object>, 'process_offerings': <cwt.wps_lib.xml.Element object>, 'languages': <cwt.wps_lib.xml.Element object>, 'operations_metadata': <cwt.wps_lib.xml.Element object>, 'wsdl': <cwt.wps_lib.xml.Element object>, 'service_provider': <cwt.wps_lib.xml.Element object>}
lang
languages
operations_metadata
process_offerings
service
service_identification
service_provider
store_value = None
update_sequence
version
wsdl

cwt.wps_lib.xml module

class cwt.wps_lib.xml.Attribute(**kwargs)

Bases: object

Attribute decorator.

This decorator represents an xml attribute. If attach is not specified then the attribute will be created on the root element.

namespace

A str namespace identifier.

value_type

A type that the attribute will hold. Default: str

required

A bool flag denoting whether the attribute is required. Default: False

attach

A str name of the element to set the attribute on.

class cwt.wps_lib.xml.Element(**kwargs)

Bases: object

Element decorator.

This decorator represents an xml element.

Examples of options.

@Element(namespace=’ns’) def test(self): pass

<ns:test />

@Element(output_list=True) def test(self): pass

<test>1</test> <test>2</test>

@Element(child_tag=’item’, child_namespace=’ns’) def test(self): pass

<test>
<ns:item>1</ns:item>

</test>

@Element(attr=’value’) def test(self): pass

<test value=”1” />

@Element(path=’/hello/once/only’, nsmap={‘once’: ‘ns’}) def test(self): pass

<hello>
<ns:once>
<only>
<test>1</test>

</only>

</ns:once>

</hello>

# NOTE: if store_value is present it will be the only property used class Test(xml.XMLDocument):

@Element(store_value=True) def test(self): pass

<Test>1</Test>

namespace

A str namesapce identifier.

output_list

A bool flag denoting wether the element has multiple children. Default: False

child_tag

A str value to create an element to wrap the value in.

child_namespace

A str namespace identifier for child_tag.

attr

A str value to name the attribute to hold the value.

path

A str path to nest the element under.

nsmap

A dict namespace map for the path.

value_type

A type that the element will hold. Default: str

store_value

A bool flag denoting that the elements contents will be the value.

minimum

An int setting the minimum number of items.

maximum

An int setting the maximum number of items.

exception cwt.wps_lib.xml.MismatchedTypeError

Bases: exceptions.Exception

exception cwt.wps_lib.xml.MissingNamespaceError

Bases: exceptions.Exception

class cwt.wps_lib.xml.Translator

Bases: object

Base translator class.

This class can be use to control how property names are transformed to xml element/attribute names and vica-versa.

element_to_attribute(name)
element_to_property(name)
property_to_attribute(name)
property_to_element(name)
exception cwt.wps_lib.xml.ValidationError

Bases: exceptions.Exception

exception cwt.wps_lib.xml.ValueConversionError

Bases: exceptions.Exception

class cwt.wps_lib.xml.XMLDocument(namespace=None, nsmap=None, tag=None, translator=None, **kwargs)

Bases: object

XMLDocument class.

This class must be inherited by as subclass. This works in conjunction with XMLDocumentMarkupType. Element and attribute decorators can be added to method definitions to create a pseudo XML schema.

class Car(XMLDocument):

__metaclass__ = XMLDocumentMarkupType

def __init__(self, **kwargs):
super(Car, self).__init__(**kwargs)

@Attribute() def color(self): pass

@Element() def engine(self): pass

c = Car(color=’blue’, engine=’V8’)

print c.xml()

<Car color=”blue”>
<engine>V8</engine>

</Car>

namespace

A str namespace identifier for the root element.

nsmap

A dict mapping namespace identifiers to namespace urls.

tag

A str value to be substituted for the class name as the root element name.

translatpor

A Translator to be use in converting names.

**kwargs

A dict of default property values.

classmethod from_element(element, translator)
classmethod from_xml(data)
generate_xml()

Generate XML from class definition.

Process the classes elements and attributes that have been declard to create an XML document.

parse_xml(root)

Parses an XML document according to the class definition.

Parameters:root – An etree.Element being the root of the document.
validate()

Validates the property values against their definitions.

Elements bounds are validated as well as attribute requirements.

Raise:
ValidationError: An error occurred validating one of the properties.
xml(pretty_print=False)

Generate str XML document from etree.Element.

class cwt.wps_lib.xml.XMLDocumentMarkupType

Bases: type

XMLDocumentMarkupType.

This type must be used with XMLDocument class to create xml documents. This metaclass will collected the elements and attribute from properties and attach them to the class.

exception cwt.wps_lib.xml.XMLError

Bases: exceptions.Exception

exception cwt.wps_lib.xml.XMLParseError

Bases: exceptions.Exception

Module contents