hooks.tk-multi-publish2.basic.publish_session module

class KatanaSessionPublishPlugin(*args, **kwargs)

Bases: sphinx.ext.autodoc.importer._MockObject

Plugin for publishing an open katana session.

This hook relies on functionality found in the base file publisher hook in the publish2 app and should inherit from it in the configuration. The hook setting for this plugin should look something like this:

hook: "{self}/publish_file.py:{engine}/tk-multi-publish2/basic/publish_session.py"
accept(settings, item)

Method called by the publisher to determine if an item is of any interest to this plugin. Only items matching the filters defined via the item_filters property will be presented to this method.

A publish task will be generated for each item accepted here. Returns a dictionary with the following booleans:

  • accepted: Indicates if the plugin is interested in this value at
    all. Required.
  • enabled: If True, the plugin will be enabled in the UI, otherwise
    it will be disabled. Optional, True by default.
  • visible: If True, the plugin will be visible in the UI, otherwise
    it will be hidden. Optional, True by default.
  • checked: If True, the plugin will be checked in the UI, otherwise
    it will be unchecked. Optional, True by default.
Parameters:
  • settings – Dictionary of Settings. The keys are strings, matching the keys returned in the settings property. The values are Setting instances.
  • item – Item to process
Returns:

dictionary with boolean keys accepted, required and enabled

description

Verbose, multi-line description of what the plugin does. This can contain simple html for formatting.

finalize(settings, item)

Execute the finalization pass. This pass executes once all the publish tasks have completed, and can for example be used to version up files.

Parameters:
  • settings – Dictionary of Settings. The keys are strings, matching the keys returned in the settings property. The values are Setting instances.
  • item – Item to process
icon

The path to an icon on disk that is representative of this plugin (str).

item_filters

List of item types that this plugin is interested in.

Only items matching entries in this list will be presented to the accept() method. Strings can contain glob patters such as , for example [“katana.”, “file.katana”]

name

The general name for this plugin (str).

publish(settings, item)

Executes the publish logic for the given item and settings.

Parameters:
  • settings – Dictionary of Settings. The keys are strings, matching the keys returned in the settings property. The values are Setting instances.
  • item – Item to process
settings

Dictionary defining the settings that this plugin expects to receive through the settings parameter in the accept, validate, publish and finalize methods.

A dictionary on the following form:

{
    "Settings Name": {
        "type": "settings_type",
        "default": "default_value",
        "description": "One line description of the setting"
}

The type string should be one of the data types that toolkit accepts as part of its environment configuration.

validate(settings, item)

Validates the given item to check that it is ok to publish. Returns a boolean to indicate validity.

Parameters:
  • settings – Dictionary of Settings. The keys are strings, matching the keys returned in the settings property. The values ar e`Setting` instances.
  • item – Item to process
Returns:

True if item is valid, False otherwise.