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 at 0x7fefab0e6cd0>, 'value': <cwt.wps_lib.xml.Element object at 0x7fefab0e6c10>}
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 = {'crs': <cwt.wps_lib.xml.Element object at 0x7fefab390450>, 'dimensions': <cwt.wps_lib.xml.Element object at 0x7fefab390490>, 'lower_corner': <cwt.wps_lib.xml.Element object at 0x7fefab390350>, 'upper_corner': <cwt.wps_lib.xml.Element object at 0x7fefab390410>}
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 at 0x7fefab0ef350>, 'supported': <cwt.wps_lib.xml.Element object at 0x7fefab0ef410>}
store_value = None
supported
class cwt.wps_lib.metadata.ComplexData(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'encoding': <cwt.wps_lib.xml.Attribute object at 0x7fefab366e10>, 'mime_type': <cwt.wps_lib.xml.Attribute object at 0x7fefab366d50>, 'schema': <cwt.wps_lib.xml.Attribute object at 0x7fefab366e50>}
elements = {'value': <cwt.wps_lib.xml.Element object at 0x7fefab366e90>}
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 at 0x7fefab0e6590>}
default
elements = {'default': <cwt.wps_lib.xml.Element object at 0x7fefab0e6490>, 'supported': <cwt.wps_lib.xml.Element object at 0x7fefab0e6550>}
maximum_megabytes
store_value = None
supported
class cwt.wps_lib.metadata.Exception(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'exception_code': <cwt.wps_lib.xml.Attribute object at 0x7fefab37ae50>, 'locator': <cwt.wps_lib.xml.Attribute object at 0x7fefab37ae90>}
elements = {'exception_text': <cwt.wps_lib.xml.Element object at 0x7fefabd46210>}
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 at 0x7fefab366890>}
elements = {'exception': <cwt.wps_lib.xml.Element object at 0x7fefab3667d0>}
exception
store_value = None
version
class cwt.wps_lib.metadata.Format(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
elements = {'encoding': <cwt.wps_lib.xml.Element object at 0x7fefab0e62d0>, 'mime_type': <cwt.wps_lib.xml.Element object at 0x7fefab0e6210>, 'schema': <cwt.wps_lib.xml.Element object at 0x7fefab0e6310>}
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 at 0x7fefab0e2f90>, 'data': <cwt.wps_lib.xml.Element object at 0x7fefab0e2fd0>, 'identifier': <cwt.wps_lib.xml.Element object at 0x7fefab0e2e90>, 'title': <cwt.wps_lib.xml.Element object at 0x7fefab0e2f50>}
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 at 0x7fefab0ef690>, 'min_occurs': <cwt.wps_lib.xml.Attribute object at 0x7fefab0ef650>}
elements = {'abstract': <cwt.wps_lib.xml.Element object at 0x7fefab0ef610>, 'identifier': <cwt.wps_lib.xml.Element object at 0x7fefab0ef510>, 'metadata': <cwt.wps_lib.xml.Element object at 0x7fefab0ef6d0>, 'title': <cwt.wps_lib.xml.Element object at 0x7fefab0ef5d0>, 'value': <cwt.wps_lib.xml.Element object at 0x7fefab0ef710>}
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 at 0x7fefab0f5750>, 'supported': <cwt.wps_lib.xml.Element object at 0x7fefab0f5810>}
store_value = None
supported
class cwt.wps_lib.metadata.LiteralData(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

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

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
data_type
default_value
elements = {'data_type': <cwt.wps_lib.xml.Element object at 0x7fefab0e6fd0>, 'default_value': <cwt.wps_lib.xml.Element object at 0x7fefab0ef150>, 'uoms': <cwt.wps_lib.xml.Element object at 0x7fefab0ef0d0>, 'value': <cwt.wps_lib.xml.Element object at 0x7fefab0ef110>}
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 at 0x7fefab0f5e90>}
elements = {'get': <cwt.wps_lib.xml.Element object at 0x7fefab0f5f50>, 'post': <cwt.wps_lib.xml.Element object at 0x7fefab0f5f90>}
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 at 0x7fefab390dd0>, 'data': <cwt.wps_lib.xml.Element object at 0x7fefab390e50>, 'identifier': <cwt.wps_lib.xml.Element object at 0x7fefab390cd0>, 'reference': <cwt.wps_lib.xml.Element object at 0x7fefab390e10>, 'title': <cwt.wps_lib.xml.Element object at 0x7fefab390d90>}
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 at 0x7fefab0e2290>}
elements = {'abstract': <cwt.wps_lib.xml.Element object at 0x7fefab0e2350>, 'encoding': <cwt.wps_lib.xml.Element object at 0x7fefab0e21d0>, 'identifier': <cwt.wps_lib.xml.Element object at 0x7fefab0e22d0>, 'mime_type': <cwt.wps_lib.xml.Element object at 0x7fefab0e2110>, 'schema': <cwt.wps_lib.xml.Element object at 0x7fefab0e2210>, 'title': <cwt.wps_lib.xml.Element object at 0x7fefab0e2310>, 'uom': <cwt.wps_lib.xml.Element object at 0x7fefab0e2250>}
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 at 0x7fefab0efb90>, 'identifier': <cwt.wps_lib.xml.Element object at 0x7fefab0efa90>, 'metadata': <cwt.wps_lib.xml.Element object at 0x7fefab0efbd0>, 'title': <cwt.wps_lib.xml.Element object at 0x7fefab0efb50>, 'value': <cwt.wps_lib.xml.Element object at 0x7fefab0efc10>}
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 at 0x7fefab0f5910>}
elements = {'abstract': <cwt.wps_lib.xml.Element object at 0x7fefab0f5a50>, 'identifier': <cwt.wps_lib.xml.Element object at 0x7fefab0f59d0>, 'metadata': <cwt.wps_lib.xml.Element object at 0x7fefab0f5a90>, 'profile': <cwt.wps_lib.xml.Element object at 0x7fefab0f5ad0>, 'title': <cwt.wps_lib.xml.Element object at 0x7fefab0f5a10>, 'wsdl': <cwt.wps_lib.xml.Element object at 0x7fefab0f5b10>}
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 at 0x7fefab0f5090>, 'status_supported': <cwt.wps_lib.xml.Attribute object at 0x7fefab0f51d0>, 'store_supported': <cwt.wps_lib.xml.Attribute object at 0x7fefab0f5190>}
elements = {'abstract': <cwt.wps_lib.xml.Element object at 0x7fefab0eff90>, 'identifier': <cwt.wps_lib.xml.Element object at 0x7fefab0efe90>, 'input': <cwt.wps_lib.xml.Element object at 0x7fefab0f5110>, 'metadata': <cwt.wps_lib.xml.Element object at 0x7fefab0effd0>, 'output': <cwt.wps_lib.xml.Element object at 0x7fefab0f5150>, 'profile': <cwt.wps_lib.xml.Element object at 0x7fefab0f5050>, 'title': <cwt.wps_lib.xml.Element object at 0x7fefab0eff50>, 'wsdl': <cwt.wps_lib.xml.Element object at 0x7fefab0f50d0>}
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 at 0x7fefab366c50>}
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 at 0x7fefab366a10>}
elements = {'value': <cwt.wps_lib.xml.Element object at 0x7fefab366ad0>}
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 = {'maximum_value': <cwt.wps_lib.xml.Element object at 0x7fefab0e6990>, 'minimum_value': <cwt.wps_lib.xml.Element object at 0x7fefab0e68d0>, 'range_closure': <cwt.wps_lib.xml.Element object at 0x7fefab0e6a10>, 'spacing': <cwt.wps_lib.xml.Element object at 0x7fefab0e69d0>}
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 = {'encoding': <cwt.wps_lib.xml.Element object at 0x7fefab0e2b90>, 'identifier': <cwt.wps_lib.xml.Element object at 0x7fefab0e2a90>, 'mime_type': <cwt.wps_lib.xml.Element object at 0x7fefab0e2b50>, 'schema': <cwt.wps_lib.xml.Element object at 0x7fefab0e2bd0>, 'uom': <cwt.wps_lib.xml.Element object at 0x7fefab0e2c10>}
encoding
identifier
mime_type
schema
store_value = None
uom
class cwt.wps_lib.metadata.Reference(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'encoding': <cwt.wps_lib.xml.Attribute object at 0x7fefab390750>, 'mime_type': <cwt.wps_lib.xml.Attribute object at 0x7fefab390690>, 'schema': <cwt.wps_lib.xml.Attribute object at 0x7fefab390790>}
body
body_reference
elements = {'body': <cwt.wps_lib.xml.Element object at 0x7fefab390890>, 'body_reference': <cwt.wps_lib.xml.Element object at 0x7fefab3908d0>, 'header': <cwt.wps_lib.xml.Element object at 0x7fefab390850>, 'href': <cwt.wps_lib.xml.Element object at 0x7fefab3907d0>, 'method': <cwt.wps_lib.xml.Element object at 0x7fefab390810>}
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 at 0x7fefab0e2810>, 'status': <cwt.wps_lib.xml.Attribute object at 0x7fefab0e2850>, 'store_execute_resposne': <cwt.wps_lib.xml.Attribute object at 0x7fefab0e2750>}
elements = {'output': <cwt.wps_lib.xml.Element object at 0x7fefab0e2890>}
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 = {'administrative_area': <cwt.wps_lib.xml.Element object at 0x7fefab0fb350>, 'city': <cwt.wps_lib.xml.Element object at 0x7fefab0fb310>, 'country': <cwt.wps_lib.xml.Element object at 0x7fefab0fb3d0>, 'delivery_point': <cwt.wps_lib.xml.Element object at 0x7fefab0fb2d0>, 'electronic_mail_address': <cwt.wps_lib.xml.Element object at 0x7fefab0fb410>, 'facsimile': <cwt.wps_lib.xml.Element object at 0x7fefab0fb290>, 'individual_name': <cwt.wps_lib.xml.Element object at 0x7fefab0fb150>, 'position_name': <cwt.wps_lib.xml.Element object at 0x7fefab0fb210>, 'postal_code': <cwt.wps_lib.xml.Element object at 0x7fefab0fb390>, 'voice': <cwt.wps_lib.xml.Element object at 0x7fefab0fb250>}
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 = {'abstract': <cwt.wps_lib.xml.Element object at 0x7fefab0fbd10>, 'access_constraints': <cwt.wps_lib.xml.Element object at 0x7fefab0fbdd0>, 'fees': <cwt.wps_lib.xml.Element object at 0x7fefab0fbd90>, 'keywords': <cwt.wps_lib.xml.Element object at 0x7fefab0fbd50>, 'profile': <cwt.wps_lib.xml.Element object at 0x7fefab0fbc90>, 'service_type': <cwt.wps_lib.xml.Element object at 0x7fefab0fbb90>, 'service_type_version': <cwt.wps_lib.xml.Element object at 0x7fefab0fbc50>, 'title': <cwt.wps_lib.xml.Element object at 0x7fefab0fbcd0>}
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_name': <cwt.wps_lib.xml.Element object at 0x7fefab0fb910>, 'provider_site': <cwt.wps_lib.xml.Element object at 0x7fefab0fb9d0>, 'service_contact': <cwt.wps_lib.xml.Element object at 0x7fefab0fba10>}
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 at 0x7fefab0e6710>, 'supported': <cwt.wps_lib.xml.Element object at 0x7fefab0e67d0>}
store_value = None
supported
class cwt.wps_lib.metadata.ValuesReference(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {}
elements = {'reference': <cwt.wps_lib.xml.Element object at 0x7fefab0e6e10>, 'values_form': <cwt.wps_lib.xml.Element object at 0x7fefab0e6ed0>}
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 = {'language': <cwt.wps_lib.xml.Attribute object at 0x7fefab102910>, 'service': <cwt.wps_lib.xml.Attribute object at 0x7fefab102890>, 'version': <cwt.wps_lib.xml.Attribute object at 0x7fefab1028d0>}
elements = {'identifier': <cwt.wps_lib.xml.Element object at 0x7fefab102950>}
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 at 0x7fefab102850>, 'service': <cwt.wps_lib.xml.Attribute object at 0x7fefab1027d0>, 'version': <cwt.wps_lib.xml.Attribute object at 0x7fefab102810>}
elements = {'process_description': <cwt.wps_lib.xml.Element object at 0x7fefab102790>}
lang
process_description
service
store_value = None
version
class cwt.wps_lib.operations.ExecuteRequest(**kwargs)

Bases: cwt.wps_lib.xml.XMLDocument

attributes = {'language': <cwt.wps_lib.xml.Attribute object at 0x7fefab102750>, 'service': <cwt.wps_lib.xml.Attribute object at 0x7fefab102610>, 'version': <cwt.wps_lib.xml.Attribute object at 0x7fefab102650>}
data_inputs
elements = {'data_inputs': <cwt.wps_lib.xml.Element object at 0x7fefab1026d0>, 'identifier': <cwt.wps_lib.xml.Element object at 0x7fefab102690>, 'response_form': <cwt.wps_lib.xml.Element object at 0x7fefab102710>}
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 = {'creation_time': <cwt.wps_lib.xml.Attribute object at 0x7fefab102510>, 'lang': <cwt.wps_lib.xml.Attribute object at 0x7fefab1023d0>, 'service': <cwt.wps_lib.xml.Attribute object at 0x7fefab102350>, 'service_instance': <cwt.wps_lib.xml.Attribute object at 0x7fefab102450>, 'status_location': <cwt.wps_lib.xml.Attribute object at 0x7fefab102410>, 'version': <cwt.wps_lib.xml.Attribute object at 0x7fefab102390>}
creation_time
data_inputs
elements = {'data_inputs': <cwt.wps_lib.xml.Element object at 0x7fefab102550>, 'output': <cwt.wps_lib.xml.Element object at 0x7fefab1025d0>, 'output_definitions': <cwt.wps_lib.xml.Element object at 0x7fefab102590>, 'process': <cwt.wps_lib.xml.Element object at 0x7fefab102490>, 'status': <cwt.wps_lib.xml.Element object at 0x7fefab1024d0>}
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 = {'language': <cwt.wps_lib.xml.Attribute object at 0x7fefab102c50>, 'schema_location': <cwt.wps_lib.xml.Attribute object at 0x7fefab102c10>, 'service': <cwt.wps_lib.xml.Attribute object at 0x7fefab102c90>}
elements = {'version': <cwt.wps_lib.xml.Element object at 0x7fefab102cd0>}
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 at 0x7fefab102a50>, 'service': <cwt.wps_lib.xml.Attribute object at 0x7fefab102990>, 'update_sequence': <cwt.wps_lib.xml.Attribute object at 0x7fefab102a10>, 'version': <cwt.wps_lib.xml.Attribute object at 0x7fefab1029d0>}
elements = {'languages': <cwt.wps_lib.xml.Element object at 0x7fefab102b90>, 'operations_metadata': <cwt.wps_lib.xml.Element object at 0x7fefab102b10>, 'process_offerings': <cwt.wps_lib.xml.Element object at 0x7fefab102b50>, 'service_identification': <cwt.wps_lib.xml.Element object at 0x7fefab102a90>, 'service_provider': <cwt.wps_lib.xml.Element object at 0x7fefab102ad0>, 'wsdl': <cwt.wps_lib.xml.Element object at 0x7fefab102bd0>}
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