comet.publication

The comet.publication module provides factory functions fetching information about publications from the remote Publishing Server connection.

See also

Class CPublication

Instances of CPublication objects

Methods

comet.publication.collectDocuments(publicationID, levels=-1)

Collect all documents of a publication in levels sub levels.

Parameters:
  • publicationID (str) – The parent publication ID.

  • levels (int) –

    How many sub levels should should the collect process respect?

    -1: All sub levels.

Returns:

The documents as publication objects.

Return type:

list[CPublication]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::collect_documents

comet.publication.getProperty(name, documentID=None)

Get a property of a publication or a document.

Parameters:
  • name (str) – The name of the property, e.g. ‘description’

  • documentID (str | None) – The document ID. When this parameter is None, the documentID is queried from comet.gDocument.

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter name is empty

    • When parameter documentID is None and comet.gDocument is None

    • When parameter documentID is None and comet.gDocument has no document ID

  • CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::get_property

comet.publication.setProperty(name, value, documentID=None)

Set a property of a publication or a document.

Parameters:
  • name (str) – The name of the property, e.g. ‘description’

  • value (str) – The new value of the property.

  • documentID (str | None) – The document ID. When this parameter is None, the documentID is queried from comet.gDocument.

Return type:

None

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter name is empty

    • When parameter documentID is None and comet.gDocument is None

    • When parameter documentID is None and comet.gDocument has no document ID

  • CometError – On internal error

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::set_property

comet.publication.checkoutByID(documentID, ID1=2, ID2=0, ID3=0, convert=0)

Check out a document using the document ID.

This function defines the environment variables required for publication scripts and executes Panelstatement 111 (Checkout)

Please note: this function allows to checkout documents independent of the Publication panel, this means: most of the values usually defined for publication nodes in the panel (such as status, info1, info2 etc.) are not available, if checkout is triggered by calling this function.

Usually these values aren’t required for checkout scripts either; the checkout script included in the standard delivery for examples refers to the ID attributes of publication nodes only, i.e. ID1, ID2, ID3 and StringID, the latter being used as the publication nodes document ID.

Documents, which are managed in the priint:planner use the ID1 attribute for the document-type, possible values are

  • 1 for publication nodes

  • 2 for document nodes

  • 3 for spread nodes

Therefore, using the default values (ID1 = 2, ID2 = 0, ID3 = 0) for the numeric IDs usually should work - at least for priint:planner publication documents.

If you intent to use this functions to checkout other documents (i.e. documents not managed with priint:planner or documents not provided by the standard CometPublication PlugIn), you must double-check these values, shortly spoken: all IDs must match the values of the corresponing publication node, if it was loaded / shown in the publication panel.

If the document is already checked out, it will just be opened from the file system resp. be brought to front.

Please note also: In InDesign® Server the function implementation is empty

Parameters:
  • documentID (str) – ID of the document in the publication system

  • ID1 (int) – Numeric ID1 of the document, usually used for the document type

  • ID2 (int) – Numeric ID2 of the document

  • ID3 (int) – Numeric ID3 of the document

  • convert (int) –

    How to handle documents created with outdated versions.

    • 0: Automatically convert

    • 1: Do not convert

    • 2: Show dialog and ask

Return type:

None

Raises:
Available:

InDesign®

CScript:

publication::checkout_by_id

comet.publication.checkinByID(documentID, ID1=2, ID2=0, ID3=0)

Check in a document using the document ID.

This function defines the environment variables required for publication scripts and executes Panelstatement 115 (Checkin)

Please note: this function allows to checkin documents independent of the Publication panel, this means: most of the values usually defined for publication nodes in the panel (such as status, info1, info2 etc.) are not available, if checkin is triggered by calling this function.

Usually these values aren’t required for checkin scripts either; the statement included in the standard delivery for examples refers to the global variable gDocumentID only, which is available independet from the publication panel. ID attributes of publication nodes only, i.e. ID1, ID2, ID3 and StringID, the latter being used as the publication nodes document ID.

Documents, which are managed in the priint:planner use the ID1 attribute for the document-type, possible values are

  • 1 for publication nodes

  • 2 for document nodes

  • 3 for spread nodes

Therefore, using the default values (ID1 = 2, ID2 = 0, ID3 = 0) for the numeric IDs usually should work - at least for priint:planner publication documents.

If you intent to use this functions to checkin other documents (i.e. documents not managed with priint:planner or documents not provided by the standard CometPublication PlugIn), you must double-check these values, shortly speaken: all IDs must match the values of the corresponing publication node, if it was loaded / shown in the publication panel.

Please note also: In InDesign® Server the function implementation is empty

Parameters:
  • documentID (str) – ID of the document in the publication system

  • ID1 (int) – Numeric ID1 of the document, usually used for the document type

  • ID2 (int) – Numeric ID2 of the document

  • ID3 (int) – Numeric ID3 of the document

Return type:

None

Raises:
Available:

InDesign®

CScript:

publication::checkout_by_id

comet.publication.revertByID(documentID, ID1=2, ID2=0, ID3=0)

Revert a checked out document defined by its documentID. Local changes made to the document will be lost.

Documents, which are managed in the priint:planner use the ID1 attribute for the document-type, possible values are

  • 1 for publication nodes

  • 2 for document nodes

  • 3 for spread nodes

Therefore, using the default values (ID1 = 2, ID2 = 0, ID3 = 0) for the numeric IDs usually should work - at least for priint:planner publication documents.

If you intent to use this functions to checkin other documents (i.e. documents not managed with priint:planner or documents not provided by the standard CometPublication PlugIn), you must double-check these values, shortly speaken: all IDs must match the values of the corresponing publication node, if it was loaded / shown in the publication panel.

Please note also: In InDesign® Server the function implementation is empty

Parameters:
  • documentID (str) – ID of the document in the publication system

  • ID1 (int) – Numeric ID1 of the document, usually used for the document type

  • ID2 (int) – Numeric ID2 of the document

  • ID3 (int) – Numeric ID3 of the document

Return type:

None

Raises:
Available:

InDesign®

CScript:

publication::revert_by_id

comet.publication.getAllParameters()

Get all defined publication parameters.

Returns:

The found elements

Return type:

list[CParameter]

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::get_all_parameters

comet.publication.getAllPublicationTypes()

Get all defined publication types.

Returns:

The found elements

Return type:

list[CPublicationType]

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::get_publication_types

comet.publication.getAllWorkflowStates()

Get all defined workflow states.

Returns:

The found elements

Return type:

list[CWorkflowStatus]

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::get_workflow_states

comet.publication.getPublications(parentID='')

Get the sub elements of a publication, or all root elements.

Parameters:

parentID (str) –

The ID of the publication to fetch children for.

  • Empty str: Fetch the root elements

Returns:

The found elements

Return type:

list[CPublication]

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::get_subnodes

comet.publication.getParameters(documentID)

Get the parameters of a document.

Parameters:

documentID (str) – The ID of the document

Returns:

The parameters as key/values in a dict

Return type:

dict[str, str]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::get_parameters

comet.publication.getWorkflowStates(documentID)

Get the workflow states of a document.

Parameters:

documentID (str) – The ID of the document

Returns:

The states for the document

Return type:

list[CWorkflowStatus]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::get_document_workflow_states

comet.publication.getWorkflowStatus(documentID)

Get the current workflow status of a document.

Parameters:

documentID (str) – The ID of the document

Returns:

The current state of the document

Return type:

CWorkflowStatus

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::get_document_workflow_status

comet.publication.getProductPlanning(documentID, entityID='', searchStr='', mappingFlag=0)

Get a list of products scheduled for the provided document.

Parameters:
  • documentID (str) – The ID of the document

  • entityID (str) – Limit to products of this entity type

  • searchStr (str) – Limit to products matching the given search criteria

  • mappingFlag (int) –

    Flag for mapping

    • 0 : Use IDs of the planned Bucket

    • 1 : Use IDs of the Planning record

    • 2 : Use IDs of planned Bucket and ID of the Planning record as parent

Returns:

List of planned products

Return type:

list[CProduct]

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter documentID is empty

    • When parameter mappingFlag has invalid value

  • CometError – On internal error

Available:

InDesign® comet_pdf®

CScript:

publication::get_document_product_planning

comet.publication.fromXMLStringList(xml)

Create a list of str from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

list[str]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

stringlist::from_xml

comet.publication.fromXMLFloatList(xml)

Create a list of float from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

list[float]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

floatlist::from_xml

comet.publication.fromXMLIntList(xml)

Create a list of ints from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

list[int]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

list::from_xml

comet.publication.fromXMLKeyValueList(xml)

Create a dict of [str, str] from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

dict[str, str]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

keyvalues::from_xml

comet.publication.fromXMLElement(xml)

Create a CElement object from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

CElement

Raises:
Available:

InDesign® comet_pdf®

CScript:

element::from_xml

comet.publication.fromXMLElementList(xml)

Create a list of CElement from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

list[CElement]

Raises:
Available:

InDesign® comet_pdf®

CScript:

elementlist::from_xml

comet.publication.fromXMLIDType(xml)

Create a CIDType object from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

CIDType

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

idtype::from_xml

comet.publication.fromXMLIDTypeList(xml)

Create a list of CIDType from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

list[CIDType]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

idtypelist::from_xml

comet.publication.fromXMLParameter(xml)

Create a CParameter object from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

CParameter

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::parameter::to_xml

comet.publication.fromXMLParameterList(xml)

Create a list of CParameter from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

list[CParameter]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::parameterlist::from_xml

comet.publication.fromXMLPlanning(xml)

Create a CPlanning object from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

CPlanning

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::planning::from_xml

comet.publication.fromXMLPlanningList(xml)

Create a list of CPlanning from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

list[CPlanning]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::planninglist::from_xml

comet.publication.fromXMLProduct(xml)

Create a CProduct object from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

CProduct

Raises:
Available:

InDesign® comet_pdf®

CScript:

product::from_xml

comet.publication.fromXMLProductList(xml)

Create a list of CProduct from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

list[CProduct]

Raises:
Available:

InDesign® comet_pdf®

CScript:

productlist::from_xml

comet.publication.fromXMLPublication(xml)

Create a CPublication object from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

CPublication

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::from_xml

comet.publication.fromXMLPublicationList(xml)

Create a list of CPublication from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

list[CPublication]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::publicationlist::from_xml

comet.publication.fromXMLPublicationType(xml)

Create a CPublicationType object from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

CPublicationType

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::publicationtype::from_xml

comet.publication.fromXMLPublicationTypeList(xml)

Create a list of CPublicationType from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

list[CPublicationType]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::publicationtypelist::from_xml

comet.publication.fromXMLWorkflowStatus(xml)

Create a CWorkflowStatus object from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

CWorkflowStatus

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::workflowstatus::from_xml

comet.publication.fromXMLWorkflowStatusList(xml)

Create a list of CWorkflowStatus from an XML string

Parameters:

xml (str) – The XML representation of this object

Returns:

The constructed object

Return type:

list[CWorkflowStatus]

Raises:
Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::workflowstatuslist::from_xml

comet.publication.toXMLStringList(input, rootElementName='strings')

Generate the XML structure of a list of strings.

Parameters:
  • input (list[str]) – The strings

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter input contains invalid values

    • When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

stringlist::to_xml

comet.publication.toXMLFloatList(input, rootElementName='floats')

Generate the XML structure of a list of floats.

Parameters:
  • input (list[float]) – The floats

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter input contains invalid values

    • When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

floatlist::to_xml

comet.publication.toXMLIntList(input, rootElementName='integers')

Generate the XML structure of a list of ints.

Parameters:
  • input (list[int]) – The ints

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter input contains invalid values

    • When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

list::to_xml

comet.publication.toXMLKeyValueList(input, rootElementName='keyvalues')

Generate the XML structure of a a key value dict

Parameters:
  • input (dict[str, str]) – The key/values

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter input contains invalid values

    • When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

keyvalues::to_xml

comet.publication.toXMLElement(element, rootElementName='element')

Generate the XML structure of a CElement object

Parameters:
  • element (CElement) – The element

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter rootElementName is empty

Available:

InDesign® comet_pdf®

CScript:

element::to_xml

comet.publication.toXMLElementList(input, rootElementName='elements')

Generate the XML structure of a list of CElement

Parameters:
  • input (list[CElement]) – The elements

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter input contains invalid values

    • When parameter rootElementName is empty

Available:

InDesign® comet_pdf®

CScript:

elementlist::to_xml

comet.publication.toXMLIDType(IDType, rootElementName='recordid')

Generate the XML structure of this object.

Parameters:
  • IDType (CIDType) – The ID type

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

idtype::to_xml

comet.publication.toXMLIDTypeList(input, rootElementName='recordids')

Generate the XML structure of a list of CIDType.

Parameters:
  • input (list[CIDType]) – The IDs

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter input contains invalid values

    • When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

idtypelist::to_xml

comet.publication.toXMLParameter(parameter, rootElementName='parameter')

Generate the XML structure of a CParameter.

Parameters:
  • parameter (CParameter) – The parameter

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::parameter::to_xml

comet.publication.toXMLParameterList(input, rootElementName='parameters')

Generate the XML structure of a list of CParameter.

Parameters:
  • input (list[CParameter]) – The parameters

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter input contains invalid values

    • When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::parameterlist::to_xml

comet.publication.toXMLPlanning(planning, rootElementName='planning')

Generate the XML structure of a CPlanning object

Parameters:
  • planning (CPlanning) – The planning

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::planning::to_xml

comet.publication.toXMLPlanningList(input, rootElementName='plannings')

Generate the XML structure of a list of CPlanning.

Parameters:
  • input (list[CPlanning]) – The plannings

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter input contains invalid values

    • When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::planninglist::to_xml

comet.publication.toXMLProduct(product, rootElementName='product')

Generate the XML structure of a CProduct object

Parameters:
  • product (CProduct) – The product

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter rootElementName is empty

Available:

InDesign® comet_pdf®

CScript:

product::to_xml

comet.publication.toXMLProductList(input, rootElementName='products')

Generate the XML structure of a list of CProduct.

Parameters:
  • input (list[CProduct]) – The products

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter input contains invalid values

    • When parameter rootElementName is empty

Available:

InDesign® comet_pdf®

CScript:

productlist::to_xml

comet.publication.toXMLPublication(publication, rootElementName='publication')

Generate the XML structure of a CPublication object

Parameters:
  • publication (CPublication) – The publication

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::to_xml

comet.publication.toXMLPublicationList(input, rootElementName='publications')

Generate the XML structure of a list of CPublication.

Parameters:
  • input (list[CPublication]) – The publications

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter input contains invalid values

    • When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::publicationlist::to_xml

comet.publication.toXMLPublicationType(publicationType, rootElementName='publicationtype')

Generate the XML structure of a CPublicationType object

Parameters:
  • publicationType (CPublicationType) – The publication type

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::publicationtype::to_xml

comet.publication.toXMLPublicationTypeList(input, rootElementName='publicationtypes')

Generate the XML structure of a list of CPublication.

Parameters:
Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter input contains invalid values

    • When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::publicationtypelist::to_xml

comet.publication.toXMLWorkflowStatus(workflowStatus, rootElementName='workflowstatus')

Generate the XML structure of a CWorkflowStatus object

Parameters:
  • workflowStatus (CWorkflowStatus) – The workflow status

  • rootElementName (str) – Name of the root element

Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError – When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::workflowstatus::to_xml

comet.publication.toXMLWorkflowStatusList(input, rootElementName='workflowstates')

Generate the XML structure of a list of CWorkflowStatus.

Parameters:
Returns:

The XML string representation of this object

Return type:

str

Raises:
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter input contains invalid values

    • When parameter rootElementName is empty

Available:

InDesign® comet_pdf® Illustrator®

CScript:

publication::workflowstatuslist::to_xml