comet.publication ******************************************************************************* .. py:module:: comet.publication The comet.publication module provides factory functions fetching information about publications from the remote Publishing Server connection. .. seealso:: Class :py:class:`.CPublication` Instances of CPublication objects Methods =============================================================================== .. autofunction:: comet.publication.collectDocuments .. autofunction:: comet.publication.getProperty .. autofunction:: comet.publication.setProperty .. autofunction:: comet.publication.getPublicationID .. autofunction:: comet.publication.getRootPublicationID .. autofunction:: comet.publication.checkoutByID .. autofunction:: comet.publication.checkinByID .. autofunction:: comet.publication.revertByID .. autofunction:: comet.publication.getAllParameters .. autofunction:: comet.publication.getAllPublicationTypes .. autofunction:: comet.publication.getAllWorkflowStates .. autofunction:: comet.publication.getPublications .. autofunction:: comet.publication.getParameters .. autofunction:: comet.publication.getWorkflowStates .. autofunction:: comet.publication.getWorkflowStatus .. autofunction:: comet.publication.getProductPlanning .. autofunction:: comet.publication.fromXMLStringList .. autofunction:: comet.publication.fromXMLFloatList .. autofunction:: comet.publication.fromXMLIntList .. autofunction:: comet.publication.fromXMLKeyValueList .. autofunction:: comet.publication.fromXMLElement .. autofunction:: comet.publication.fromXMLElementList .. autofunction:: comet.publication.fromXMLIDType .. autofunction:: comet.publication.fromXMLIDTypeList .. autofunction:: comet.publication.fromXMLParameter .. autofunction:: comet.publication.fromXMLParameterList .. autofunction:: comet.publication.fromXMLPlanning .. autofunction:: comet.publication.fromXMLPlanningList .. autofunction:: comet.publication.fromXMLProduct .. autofunction:: comet.publication.fromXMLProductList .. autofunction:: comet.publication.fromXMLPublication .. autofunction:: comet.publication.fromXMLPublicationList .. autofunction:: comet.publication.fromXMLPublicationType .. autofunction:: comet.publication.fromXMLPublicationTypeList .. autofunction:: comet.publication.fromXMLWorkflowStatus .. autofunction:: comet.publication.fromXMLWorkflowStatusList .. autofunction:: comet.publication.toXMLStringList .. autofunction:: comet.publication.toXMLFloatList .. autofunction:: comet.publication.toXMLIntList .. autofunction:: comet.publication.toXMLKeyValueList .. autofunction:: comet.publication.toXMLElement .. autofunction:: comet.publication.toXMLElementList .. autofunction:: comet.publication.toXMLIDType .. autofunction:: comet.publication.toXMLIDTypeList .. autofunction:: comet.publication.toXMLParameter .. autofunction:: comet.publication.toXMLParameterList .. autofunction:: comet.publication.toXMLPlanning .. autofunction:: comet.publication.toXMLPlanningList .. autofunction:: comet.publication.toXMLProduct .. autofunction:: comet.publication.toXMLProductList .. autofunction:: comet.publication.toXMLPublication .. autofunction:: comet.publication.toXMLPublicationList .. autofunction:: comet.publication.toXMLPublicationType .. autofunction:: comet.publication.toXMLPublicationTypeList .. autofunction:: comet.publication.toXMLWorkflowStatus .. autofunction:: comet.publication.toXMLWorkflowStatusList Examples =============================================================================== .. code-block:: python :caption: Recursively walk through all publications and output them to the logfile with proper indentation. #!py #pragma plain import comet def walkPublications(parentID: str = '', recursive: bool = True, depth: int = 0): #Fetch all publications. When parentID is empty we get the root entries = comet.publication.getPublications(parentID) for entry in entries: name = entry.getValue(comet.constants.kPublicationName) hasChildren = entry.getValue(comet.constants.kPublicationHasChildren) #depth is only used for indentation in the logfile logPrefix = '' for i in range(depth): logPrefix += '\t' comet.wlog(f'{logPrefix}Publication "{name}":') #We simply use all available selectors to get all the information we need for selector, label in comet.constants.kPublicationSelectors.items(): value = None #We use try/catch here since getValue throws when the selector is invalid try: value = entry.getValue(selector) except: continue comet.wlog(f'{logPrefix}\tSelector: {label} - Value: {value}') if hasChildren and recursive: #Recursively walk down parentID = entry.getValue(comet.constants.kPublicationStringid) walkPublications(parentID, True, depth + 1) def main(): #Start walking through publications from the root walkPublications() return 0