OpenAssetIO
An abstract API for generalising interactions between a host application and an asset management system
Mapper Class Reference

The Mapper class provides string substitution methods and lookups to determine the correct terminology for the supplied manager. More...

Public Member Functions

def __init__ (self, manager, terminology=defaultTerminology)
 Constructs a new Mapper using terminology overrides defined by the supplied Manager. More...
 
def replaceTerms (self, sourceStr)
 Substitutes any valid terminology tokens in the input string with those appropriate to the current Manager. More...
 
def term (self, key, default="")
 Returns the term corresponding to the supplied key, openassetio.hostApi.terminology under kTerm_*. More...
 

Detailed Description

The Mapper class provides string substitution methods and lookups to determine the correct terminology for the supplied manager.

Warning
This method or class has not been updated for the new C++ API and may be subject to a changes in signature in subsequent releases.

Constructor & Destructor Documentation

def __init__ (   self,
  manager,
  terminology = defaultTerminology 
)

Constructs a new Mapper using terminology overrides defined by the supplied Manager.

The manager is queried during construction and it's results cached for the lifetime of the Mapper.

Parameters
managerManager, A Manager instance, whose terminology should be applied by the mapper.
terminologyA dict of terms that will be substituted by this instance. If left unspecified, the default API terminology will be used. Hosts may take a copy of this dictionary and append to it before passing to the Mapper to allow managers to customize additional host-specific terms. There is no expectation that a manager would handle new terms without specific knowledge in advance.

Member Function Documentation

def replaceTerms (   self,
  sourceStr 
)

Substitutes any valid terminology tokens in the input string with those appropriate to the current Manager.

These tokens are as per python format convention, using the constants defined in openassetio.hostApi.terminology under kTerm_*. For example:

  • "{publish} to {manager}..."
Warning
Escaping brace literals with {{ is not currently supported.
Parameters
sourceStra string to substitute.
Returns
str The input string with all applicable terms substituted, any remaining braces ({}) will be removed.
def term (   self,
  key,
  default = "" 
)

Returns the term corresponding to the supplied key, openassetio.hostApi.terminology under kTerm_*.

Returns
str or the supplied default if the key is unknown.

The documentation for this class was generated from the following file:
  • /src/src/openassetio-python/package/openassetio/hostApi/terminology.py