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.
4.3.3.1. EDM Elements¶
4.3.3.1.1. Feed Customisation¶
-
class
pyslet.odata2.metadata.
EntityType
(parent)¶ Bases:
pyslet.odata2.csdl.EntityType
,pyslet.odata2.metadata.FeedCustomisationMixin
Supports feed customisation behaviour of EntityTypes
-
get_source_path
()¶ 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.
-
has_stream
()¶ Returns true if this is a media link resource.
Read from the HasStream attribute. The default is False.
-
-
class
pyslet.odata2.metadata.
Property
(parent)¶ Bases:
pyslet.odata2.csdl.Property
,pyslet.odata2.metadata.FeedCustomisationMixin
Supports feed customisation behaviour of Properties
-
class
pyslet.odata2.metadata.
FeedCustomisationMixin
¶ Bases:
object
Utility class used to add common feed customisation attributes
-
get_target_path
()¶ 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.
-
keep_in_content
()¶ 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.
-
get_fc_ns_prefix
()¶ 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.
-
4.3.3.1.2. Entity Containers¶
-
class
pyslet.odata2.metadata.
EntityContainer
(parent)¶ Bases:
pyslet.odata2.csdl.EntityContainer
Supports OData’s concept of the default container.
-
is_default_entity_container
()¶ Returns True if this is the default entity container
The value is read from the IsDefaultEntityContainer attribute. The default is False.
-
-
class
pyslet.odata2.metadata.
EntitySet
(parent)¶ Bases:
pyslet.odata2.csdl.EntitySet
-
set_location
()¶ 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.
-
4.3.3.2. 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.
-
validate
()¶ 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.
-
classmethod
-
class
pyslet.odata2.metadata.
DataServices
(parent)¶ Bases:
pyslet.odata2.edmx.DataServices
Adds OData specific behaviour
-
defaultContainer
= None¶ the default entity container
-
data_services_version
()¶ Returns the data service version
Read from the DataServiceVersion attribute. Defaults to None.
-
search_containers
(name)¶ 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.
-