module documentation

ZMS repository utility module

This module provides helpful functions and classes for use in Python Scripts. It can be accessed from Python with the statement "import Products.zms.repository"

Function get_class Undocumented
Function get_diffs Undocumented
Function get_init_py Generate a Python class representation of a given object.
Function get_init_yaml Serialize a Python object into a YAML-formatted string.
Function get_providers Undocumented
Function get_system_conf_basepath Undocumented
Function init_artefacts Generate a dictionary of initialization artefacts from the given object and initialization files.
Function localFiles Undocumented
Function parseInit Undocumented
Function readRepository Undocumented
Function remoteFiles Undocumented
Variable security Returns system conf-basepath.
def get_class(py): (source)

Undocumented

def get_diffs(local, remote, ignore=True): (source)

Undocumented

def get_init_py(self, o): (source)

Generate a Python class representation of a given object.

This function takes an object `o` (typically a dictionary) and generates a Python class definition as a list of strings. The generated class includes attributes and nested classes based on the structure and content of the input object.

Args: self: The instance of the class calling this method. o (dict): The input object containing keys and values to be represented as a Python class.

Returns: list: A list of strings representing the Python class definition.

def get_init_yaml(self, o): (source)

Serialize a Python object into a YAML-formatted string.

This method processes a given object `o` and converts it into a YAML representation. It handles attributes and keys in the object, ensuring that non-serializable elements (e.g., Acquisition-Wrappers) are excluded.

Args: self: The instance of the class containing this method. o (dict): The input dictionary-like object to be serialized. It is expected to have keys and values that can be processed into a YAML-compatible format.

Returns: str: A YAML-formatted string representing the serialized object.

def get_providers(self): (source)

Undocumented

def get_system_conf_basepath(): (source)

Undocumented

def init_artefacts(o, init_files): (source)

Generate a dictionary of initialization artefacts from the given object and initialization files.

Args: self: The instance of the class containing this method. o (dict): A dictionary representing the object to process. It may contain:

  • 'id': The identifier of the object.
  • 'acquired': A flag indicating if the object is acquired (0 or 1).
  • '__filename__': A list representing the filename structure.
  • '__icon__': An optional icon for the object.
  • '__description__': An optional description for the object.
  • 'revision': A version string in the format "0.0.0".
  • Other keys representing attributes, where capitalized keys with list values are processed.

initFiles (dict): A dictionary where keys are formats (e.g., 'py') and values are lists of strings representing the initialization data for each format.

Returns: dict: A dictionary where keys are filenames and values are dictionaries containing:

  • 'id': The identifier of the object.
  • 'filename': The full path of the file.
  • 'data': The content of the file.
  • 'version': The version of the file as a list of integers.
  • 'meta_type': The meta type of the object (e.g., 'Script (Python)').
  • '__icon__': The icon of the object (if provided).
  • '__description__': The description of the object (if provided).
def localFiles(self, provider, ids=None): (source)

Undocumented

def parseInit(self, filepath): (source)

Undocumented

def readRepository(self, basepath, deep=True): (source)

Undocumented

def remoteFiles(self, basepath, deep=True): (source)

Undocumented

security = (source)

Returns system conf-basepath.