maxon.AssetTypeInterface¶
Description¶
Class to store and find any maxon.Data
type under any type of key.
Warning
Methods Signature¶
|
ComputeMetaData to specialize the loading of meta data. |
|
Copies the asset with encryption to the new url. |
Returns the DataType of assets handled by this |
|
|
Returns the default icon of this asset type. |
|
Returns the identifier of this asset type. |
|
Returns the translated string from a asset. |
|
Returns the default id of the asset. |
|
Returns the |
|
Loads an asset from a Url. |
|
Loads the data description of the given asset. |
|
|
|
Stores the name of an asset for a language. |
Methods Definition¶
-
AssetTypeInterface.
ComputeMetaData
(repository, asset, meta, metaId)¶ ComputeMetaData to specialize the loading of meta data.
- Parameters
repository (
maxon.AssetRepositoryRef
) – Repository where the asset is stored.asset (
maxon.Tuple
[maxon.Id
,maxon.Id
]) – Asset id and version.meta (
maxon.AssetMetaData
) – Meta data of the asset.metaId (
maxon.InternedId
) – MetaId to load.
- Returns
Data contains the data. Bool if the value should be cached.
- Return type
-
AssetTypeInterface.
CopyWithEncryption
(source, urlFrom, urlTo)¶ Copies the asset with encryption to the new url.
- Parameters
source (
maxon.AssetDescription
) – Asset to copy.urlFrom (
maxon.Url
) – source url.urlTo (
maxon.Url
) – destination url.
-
AssetTypeInterface.
GetAssetDataType
()¶ Returns the DataType of assets handled by this
maxon.AssetType
. The data type has to be a reference type derived frommaxon.Asset
.- Returns
The data type of assets of this
maxon.AssetType
.- Return type
-
AssetTypeInterface.
GetDefaultIcon
(repository, asset, meta)¶ Returns the default icon of this asset type.
- Parameters
repository (
maxon.AssetRepositoryRef
) – Repository to search for.asset (
maxon.Tuple
[maxon.Id
,maxon.Id
]) – Asset id and version.meta (
maxon.AssetMetaData
) – meta data of the asset to store.
- Returns
- Return type
-
AssetTypeInterface.
GetId
()¶ Returns the identifier of this asset type. This has to be the same as used for the
maxon.AssetTypes
registry.- Returns
Asset type identifier.
- Return type
-
AssetTypeInterface.
GetMetaString
(asset, key, languageRef, fallback)¶ Returns the translated string from a asset.
- Parameters
asset (
maxon.AssetDescription
) – Asset to load.key (
maxon.InternedId
) – Attribute id to load. e.g. maxon.OBJECT.BASE.NAMElanguageRef (
maxon.LanguageRef
) – Optional language. By default the function uses the current language.fallback (str) – Fallback string if the asset has no name.
- Returns
String on success.
- Return type
str
-
AssetTypeInterface.
GetRepositoryId
(id, fromTo)¶ Returns the default id of the asset.
-
AssetTypeInterface.
GetUrlSuffix
(asset)¶ Returns the
maxon.Url
suffix (file name ending without the dot) to use for the given asset.- Parameters
asset (
maxon.Asset
) – An asset, has to match the expected data type of thismaxon.AssetType
.- Returns
The Url suffix to use, may be empty.
- Return type
-
AssetTypeInterface.
Load
(repo, assetDescription, url, updateLinks=None)¶ Loads an asset from a Url.
- Parameters
repo (
maxon.AssetRepositoryRef
) – The repository to which the asset belongs.assetDescription (
maxon.AssetDescription
) – The asset description.url (
maxon.Url
) – Themaxon.Url
from which the asset shall be loaded.updateLinks (Optional[bool]) –
None if the asset shall be loaded as is.A boolean if asset links which use ASSET_UPDATE_POLICY.IMPLICIT shall be resolved to the latest version.
- Returns
The loaded asset and a boolean sets to True whenever there is a link where the resolved version differs from the original version.
- Return type
Tuple[
maxon.Asset
, bool]
-
AssetTypeInterface.
LoadDescriptionDefinition
(asset, mode, category, language)¶ Loads the data description of the given asset.
- Parameters
asset (
maxon.AssetDescription
) – Asset to load.mode (
maxon.LOADDESCRIPTIONMODE
) – see LOADDESCRIPTIONMODE.category (
maxon.Id
) – DATADESCRIPTION_CATEGORY_xxxlanguage (
maxon.LanguageRef
) – Language id in case of DATADESCRIPTION_CATEGORY_STRING.
- Returns
ataDescriptionDefinition on success.
- Return type
maxon.DataDescriptionDefinition
-
AssetTypeInterface.
StoreDescriptionDefinition
(asset, category, language, overwrittenDescription, storeRepository)¶ - Parameters
asset (
maxon.AssetDescription
) – Asset to store.category (
maxon.Id
) – DATADESCRIPTION_CATEGORY_xxxlanguage (
maxon.LanguageRef
) – Language id in case of DATADESCRIPTION_CATEGORY_STRING.overwrittenDescription (
maxon.DataDescriptionDefinition
) – Additional description with overwritten parameters.storeRepository (
maxon.AssetRepositoryRef
) – Repository to store the asset.
- Returns
AssetDescription with the new asset on success.
- Return type
-
AssetTypeInterface.
StoreMetaString
(asset, key, value, languageRef)¶ Stores the name of an asset for a language.
- Parameters
asset (
maxon.AssetDescription
) – Asset to modify.key (
maxon.InternedId
) – Attribute id to save. e.g. maxon.OBJECT.BASE.NAMEvalue (str) – New string.
languageRef (
maxon.LanguageRef
) – Optional language. By default the function uses the current language.