Metadata Python Module

This is the metadata library.

The pacifica.uploader.metadata module exports classes and methods for manipulating and serializing the metadata for bundles of files.

Encoding and decoding to the JSON data format is supported for compatible objects (see pacifica.uploader.metadata.Json module for more information).

class pacifica.uploader.metadata.MetaData(*args, **kwargs)[source]

Class to hold a list of MetaObj and FileObj objects.

This class is a sub-class of list that implements the index protocol (__getitem__, __setitem__ and __delitem__) as a proxy to the indices of the value of the metaID field of the associated instance of the pacifica.uploader.metadata.MetaObj class.

Instances of this class are upper-level objects that provide the metadata for interacting with the designated Pacifica Ingest server.

__delitem__(key)[source]

Delete the item from the array and hash.

__getitem__(key)[source]

Get the node based on metaID.

__init__(*args, **kwargs)[source]

Call the super constructor and add a metaID index to it as well.

__setitem__(key, value)[source]

Set the item and if metaID exists save the index into a map.

__weakref__

list of weak references to the object (if defined)

append(value)[source]

Append the value to the list.

extend(iterable)[source]

Extend the array from the values in iterable.

insert(key, value)[source]

Insert the value to the list.

is_valid()[source]

Return true if all the values of MetaObjs are something.

pop(key=-1)[source]

Remove the key from the list and return it.

remove(value)[source]

Remove the value from the list.

class pacifica.uploader.metadata.MetaObj[source]

MetaObj class holding a specific metadata element.

Instances of this class represent units of metadata whose representation is disjoint to a file, i.e., units of metadata that are describe but are not stored as part of a file.

class pacifica.uploader.metadata.FileObj[source]

FileObj class for holding file metadata.

Instances of this class represent individual files, including both the data and metadata for the file. During a file upload, instances of this class are automatically associated with new instances of the pacifica.uploader.metadata.MetaData class.

The above named fields are identical to those of the pacifica.metadata.orm.Files class, provided by the Pacifica Metadata library.

class pacifica.uploader.metadata.MetaUpdate(user, *args, **kwargs)[source]

Class to update the MetaData object.

This class is a sub-class of the pacifica.uploader.metadata.MetaData class that is specialized to issue and handle queries to Pacifica Policy servers.

__init__(user, *args, **kwargs)[source]

Pull the user from the arguments so we can use that for policy queries.

dependent_meta_id(meta_id)[source]

Get the dependent meta ID.

directory_prefix()[source]

Return the directory prefix of the MetaObjs which have directoryOrder.

get_auth()[source]

Return the auth object to be used by other instances.

query_results(meta_id)[source]

Build a PolicyQuery out of the meta_id.

This method creates a pacifica.uploader.metadata.PolicyQuery object that queries the policy server and returns the results.

update_parents(meta_id)[source]

Update the parents of the meta_id.

pacifica.uploader.metadata.metadata_encode(md_obj)[source]

Encode the MetaData object into a json string.

This method encodes the given instance of the pacifica.uploader.metadata.MetaData class, md_obj, as a JSON object, and then returns its JSON serialization.

Associated instances of the pacifica.uploader.metadata.MetaObj and pacifica.uploader.metadata.FileObj classes are automatically included in the JSON object and the resulting JSON serialization.

pacifica.uploader.metadata.metadata_decode(json_str)[source]

Decode the json string into MetaData object.

This method deserializes the given JSON source, json_str, and then returns a new instance of the pacifica.uploader.metadata.MetaData class.

The new instance is automatically associated with new instances of the pacifica.uploader.metadata.MetaObj and pacifica.uploader.metadata.FileObj classes.