4.3.3. OData Metadata Classes

This module defines sub-classes of those defined in the EDM that include special handling of the OData defined metadata attributes. EDM Elements Feed Customisation

class pyslet.odata2.metadata.EntityType(parent)

Bases: pyslet.odata2.csdl.EntityType, pyslet.odata2.metadata.FeedCustomisationMixin

Supports feed customisation behaviour of EntityTypes


Returns the source path

This result is read from the FC_SourcePath attribute. It is a list of property names that represents a path into the entity or None if there is no source path set.


Returns true if this is a media link resource.

Read from the HasStream attribute. The default is False.

GetSourcePath(*args, **kwargs)

Deprecated equivalent to get_source_path()

HasStream(*args, **kwargs)

Deprecated equivalent to has_stream()

class pyslet.odata2.metadata.Property(parent)

Bases: pyslet.odata2.csdl.Property, pyslet.odata2.metadata.FeedCustomisationMixin

Supports feed customisation behaviour of Properties


Returns the media type of a property

The result is read from the MimeType attribute. It is a MediaType instance or None if the attribute is not defined.

GetMimeType(*args, **kwargs)

Deprecated equivalent to get_mime_type()

class pyslet.odata2.metadata.FeedCustomisationMixin

Bases: pyslet.pep8.MigratedClass

Utility class used to add common feed customisation attributes


Returns the target path for an element

The result is a list of qualified element names, that is, tuples of (namespace,name). The last name may start with ‘@’ indicating an attribute rather than an element.

Feed customisations are declared using the FC_TargetPath attribute. Returns None if there is no target path declared.


Returns true if a property value should be kept in the content

This is indicated with the FC_KeepInContent attribute. If the attribute is missing then False is returned, so properties with custom paths default to being omitted from the properties list.


Returns the custom namespace mapping to use.

The value is read from the FC_NsPrefix attribute. The result is a tuple of: (prefix, namespace uri).

If no mapping is specified then (None,None) is returned.

GetFCNsPrefix(*args, **kwargs)

Deprecated equivalent to get_fc_ns_prefix()

GetTargetPath(*args, **kwargs)

Deprecated equivalent to get_target_path()

KeepInContent(*args, **kwargs)

Deprecated equivalent to keep_in_content() Entity Containers

class pyslet.odata2.metadata.EntityContainer(parent)

Bases: pyslet.odata2.csdl.EntityContainer

Supports OData’s concept of the default container.


Returns True if this is the default entity container

The value is read from the IsDefaultEntityContainer attribute. The default is False.

IsDefaultEntityContainer(*args, **kwargs)

Deprecated equivalent to is_default_entity_container()

class pyslet.odata2.metadata.EntitySet(parent)

Bases: pyslet.odata2.csdl.EntitySet


Overridden to add support for the default entity container

By default, the path to an EntitySet includes the name of the container it belongs to, e.g., MyDatabase.MyTable. This implementation checks to see if we in the default container and, if so, omits the container name prefix before setting the location URI. EDMX Elements

class pyslet.odata2.metadata.Document(**args)

Bases: pyslet.odata2.edmx.Document

Class for working with OData-specific metadata documents.

Adds namespace prefix declarations for the OData metadata and OData dataservices namespaces.

classmethod get_element_class(name)

Returns the class used to represent an element.

Overrides get_element_class() to use the OData-specific implementations of the edmx/csdl classes defined in this module.


Validates any declared OData extensions

Checks many of the requirements given in the specification and raises InvalidMetadataDocument if the tests fail.

Returns the data service version required to process the service or None if no data service version is specified.

Validate(*args, **kwargs)

Deprecated equivalent to validate()

class pyslet.odata2.metadata.DataServices(parent)

Bases: pyslet.odata2.edmx.DataServices

Adds OData specific behaviour

defaultContainer = None

the default entity container


Returns the data service version

Read from the DataServiceVersion attribute. Defaults to None.


Returns an entity set or service operation with name

name must be of the form:

[<entity container>.]<entity set, function or operation name>

The entity container must be present unless the target is in the default container in which case it must not be present.

If name can’t be found KeyError is raised.

DataServicesVersion(*args, **kwargs)

Deprecated equivalent to data_services_version()

SearchContainers(*args, **kwargs)

Deprecated equivalent to search_containers()