Skip to main content

Templates

create_comet_page(...)​

( page_template_id = 0, parent_page = 0 )​

Create a new CProduct object with settings for creating a new page, when established.

Parameters:page_template_id (int)
The ID of the page-template to be created by this product.
parent_page (int)
The full name of the parent-page (for example: "A-Parent") to be applied on the page created by this product.
Returns:A comet-Product.
Return Type:comet.CProduct

create_comet_product(...)​

( string_id = "", template_id = 0 )​

Create a new CProduct object with settings for placing the given template and linking it with the given string-id, when established.

Parameters:string_id (str)
A string-id to be used as record-id for the template.
template_id (int)
The ID of the template to be selected for this product.
Returns:A comet-Product.
Return Type:comet.CProduct

Class: ProductList​

This class can be used as shortcut for populating and further interacting with a list of comet.CProduct.

ProductList(...)​

( products = None )​

Create a new ProductList-instance based on a given list of CProducts or another ProductList-instance.

Parameters:products (list[comet.CProduct | ProductList])
A string-id to be used as record-id for the template.
Returns:A ProductList (based on native python List).
Return Type:ProductList

add_page(...)​

( page_template_id = 0, parent_page = 0 )​

Add a new CProduct object to the ProductList. See create_comet_product

Parameters:page_template_id (int)
The ID of the page-template to be created by this product.
parent_page (int)
The full name of the parent-page (for example: "A-Parent") to be applied on the page created by this product.
Returns:A comet-Product.
Return Type:comet.CProduct

add_product(...)​

( string_id = "", template_id = 0 )​

Add a new CProduct object to the ProductList. See create_comet_product

Parameters:string_id (str)
A string-id to be used as record-id for the template.
template_id (int)
The ID of the template to be selected for this product.
Returns:A comet-Product.
Return Type:comet.CProduct

Class: TemplateMapping​

This class can be used as a shortcut for creating a productlist with template-items based on predefined template-mappings. Template-ids can be retrieved from the mappings in the classe's mappings-variable using different methods (for example based on data given in the datafile or priint:cloud-request-parameters). From these ids a productlist can be generated.

Enumerator: Method​

EnumeratorValue
DEFAULT0
BY_KEY1
BY_KEY_REQUESTPARAM2
BY_KEY_XMLDATA3
BY_IDS_XMLDATA4

TemplateMapping(...)​

( mapping_origin, dataprovider = None, mapping_key = "" )​

Creates an instance of TemplateMapping. During initialization template-identifiers are set. Depending on the chosen mapping-origin, these may be retrieved from the XML-datafile using the given dataprovider or from the dictionary mappings of the this class using a mapping_key that could be given or retrieved from the XML-datafile or request-parameters of the priint:cloud-ticket.

Parameters:mapping_origin (Method)
dataprovider (DataProvider)
A dataprovider for an entity in the XML-datafil to retrieve template-data from, in case such a method is selected in parameter mapping_origin.
mapping_key (str)
A key to a template-mapping in the dictionary mappings of the this class.
Returns:An instance of TemplateMapping
Return Type:TemplateMapping

find_mapping_id(...)​

( mapping_key, attribute, default_fallback = True, custom_fallback = None )​

Retrieves a value from the given attribute of a mapping from the dictionary at the object's variable mappings by a given key.

Parameters:mapping_key (str)
Key of a mapping in the dictionary's veriable mappings.
attribute (str)
Key of a key-value-pair in the mapping.
default_fallback (bool)
Whether to return the attribute-value from the default-mapping or a custom fallback-value.
custom_fallback (Any)
Any value to be returned if default_fallback is set to False.
Returns:The value of the requested attribute of the mapping at the given mapping-key.
Return Type:int | str

find_template_id(...)​

( mapping_key, fallback = "" )​

Retrieves a value from the template_id-attribute of a mapping from the dictionary at the object's variable mappings by a given key.

Parameters:mapping_key (str)
Key of a mapping in the dictionary's veriable mappings.
fallback (Any)
Any value to be returned if no value is found for the requested attribute.
Returns:The value of the requested template_id-attribute of the mapping at the given mapping-key.
Return Type:int

find_page_template_id(...)​

( mapping_key, fallback = "" )​

Retrieves a value from the pagetemplate_id-attribute of a mapping from the dictionary at the object's variable mappings by a given key.

Parameters:mapping_key (str)
Key of a mapping in the dictionary's veriable mappings.
fallback (Any)
Any value to be returned if no value is found for the requested attribute.
Returns:The value of the requested pagetemplate_id-attribute of the mapping at the given mapping-key.
Return Type:int

find_parent_page(...)​

( mapping_key, fallback = "" )​

Retrieves a value from the parent_page-attribute of a mapping from the dictionary at the object's variable mappings by a given key.

Parameters:mapping_key (str)
Key of a mapping in the dictionary's veriable mappings.
fallback (Any)
Any value to be returned if no value is found for the requested attribute.
Returns:The value of the requested parent_page-attribute of the mapping at the given mapping-key.
Return Type:str

get_mapping_ids()​

Retrieves values from the all default-attributes of a mapping from the dictionary at the object's variable mappings by a given key.

Returns:A tuple containing the pagetemplate-id, parent-page and template-id
Return Type:Tuple[int,str,int]

get_productlist(...)​

( string_ids = None )​

Creates a ProductList of the given string-ids using current mapping's ids. Creates one page-item at the beginning of the list and a product-item for each given string-id.

Parameters:string_ids (list)
A list of string-ids. For each string-id, a product-template from the mapping (template_id) is added.
Returns:An instance of ProductList
Return Type:ProductList