comet.CProduct

class comet.CProduct

This section describes all functions for the CProduct class.

See also

comet.product

Methods

CProduct.getID()

Get the record ID of the product.

This is a convenience function for calling getAttribute() with keys constants.kProductID, constants.kProductID2, constants.kProductID3 and constants.kProductStringID, assembled as a CIDType object.

Returns:

The ID of the product

Return type:

CIDType

Available:

InDesign® comet_pdf® Illustrator®

CScript:
CProduct.setID(ID)

Set the record ID of the product.

This is a convenience function for calling setAttribute() with keys constants.kProductID, constants.kProductID2, constants.kProductID3 and constants.kProductStringID.

Parameters:

ID (tuple[int, int, int, str] | CIDType) – The new product record ID.

Return type:

None

Available:

InDesign® comet_pdf® Illustrator®

Raises:

TypeError – When parameter types are invalid

CScript:
CProduct.getName()

Get the name of a product.

This is a convenience function for calling getAttribute() with key constants.kProductRow1

Returns:

The name of the product as displayed in the product pool

Return type:

str

Available:

InDesign® comet_pdf® Illustrator®

CScript:

product::gets

CProduct.getAttribute(key)

Fetch an attribute of a product. Depending on the attribute fetched, the return type may vary.

Parameters:

key (int) –

The key of the attribute to be fetched.

For available selectors and the resulting return type see Product selectors.

Returns:

The value which belongs to the key.

Return type:

str | int, depending on the key

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:
CProduct.setAttribute(value)

Set an attribute of a product.

The value type depends on the attribute you want to set which can be found at Product selectors.

Parameters:
  • key (int) – The key of the attribute to set

  • value (int | str) – The value to set

Return type:

None

Raises:
  • TypeError

    • When parameter types are invalid

    • When parameter type of value mismatches the selector from key

  • ValueError – When parameter key has invalid value

  • CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

product::set

Special methods

CProduct.__repr__()

String representation.

Returns:

<CProduct> Name: Name (Row 1)

ID1: ID1 | ID2: ID2 | ID3: ID3 | StringID: ‘StringID

Template ID: Template ID

Example
<CProduct> Name: Bloody Mary
ID1: 5 | ID2: 1 | ID3: 0 | StringID: ''
Template ID: 0

Return type:

str