comet.prefs

The comet.prefs module provides functions for setting global preferences for the current session

Methods

comet.prefs.getAddW2MLToTemplates()

Fetch whether to add w2ml to templates.

Returns

Whether the option is turned on

Return type

bool

Raises

CometError – On internal error

Available

See also

setAddW2MLToTemplates()

CScript

prefs::add_w2ml_to_templates

comet.prefs.setAddW2MLToTemplates(enable)

Save an W2ML version of every template after creating or changing the templates data file. Using XML or SOAP, simply an W2ML version of the template is generated in the same folder like the template (pageitems/data/NNN.w2ml in most cases). SQL connections using the panelstatement 137 to save the w2ml data. If this statement is empty or missing, update pageitems set dataW2ML = where id = ? is used automatically.

The option is turned off automatically at logout time.

Normally you use your login script (panelstatement 92) to turn on the option.

Parameters

enable (bool) – Enable the option?

Return type

None

Raises
Available

See also

getAddW2MLToTemplates()

CScript

prefs::add_w2ml_to_templates

comet.prefs.getAddW2MLToSnippets()

Fetch whether to add w2ml to snippets.

Returns

Whether the option is turned on

Return type

bool

Raises

CometError – On internal error.

Available

See also

setAddW2MLToSnippets()

CScript

prefs::add_w2ml_to_snippets

comet.prefs.setAddW2MLToSnippets(enable)

Save a W2ML version of every snippet after creating or changing the snippets.

The option is turned off automatically at logout time.

Normally you use your login script (panelstatement 92) to turn on the option.

Parameters

enable (bool) – Enable the option?

Return type

None

Raises
Available

See also

getAddW2MLToSnippets()

CScript

prefs::add_w2ml_to_snippets

comet.prefs.getAddMetaDataToTemplates()

Fetch whether to metadata to templates.

Returns

Whether the option is turned on.

Return type

bool

Raises

CometError – On internal error.

Available

See also

setAddMetaDataToTemplates()

CScript

prefs::add_metadata_to_templates

comet.prefs.setAddMetaDataToTemplates(enable)

Save Metadata of every template after creating or changing the templates data file. Using XML or SOAP, a zipped folder of the template metadata with file extension meta.zip is generated in the same folder like the template (pageitems/data/NNN.w2ml in most cases).

SQL connections use the panelstatement 146 to save the metadata.

If this statement is empty or missing, update pageitems set metadata = where id = ? is used automatically. For page templates, the statement update pagetemplates set metadata = where id = ? is used

The option is turned off automatically at logout time.

Normally you use your login script (panelstatement 92) to turn on the option.

Parameters

enable (bool) – Enable the option?

Return type

None

Raises
See also

getAddMetaDataToTemplates()

Available

CScript

prefs::add_metadata_to_templates

comet.prefs.getTagsReadable()

Get whether Comet placeholders should be read and automatically created when importing TaggedText.

Returns

The value.

Return type

bool

Raises

CometError – On internal error.

Available

See also

setTagsReadable()

CScript

prefs::get_tags_readable

comet.prefs.setTagsReadable(enable)

Set whether Comet placeholders should be read and automatically created when importing TaggedText.

Parameters

enable (bool) – The new value.

Returns

The old value.

Return type

bool

Raises
Available

See also

getTagsReadable()

CScript

prefs::set_tags_readable

comet.prefs.getTagsWriteable()

Fetch whether write Comet placeholders to tagged text.

Returns

Whether the option is turned on.

Return type

bool

Raises

CometError – On internal error.

Available

See also

setTagsWriteable()

CScript

prefs::get_tags_writeable

comet.prefs.setTagsWriteable(enable)

Set whether to write Comet place holders to tagged text or not.

Ignored while generating comet.kExportTT (contains no place holders) and comet.kExportW2 (contains place holders).

Parameters

enable (bool) – Enable the option?

Return type

None

Raises
See also

getTagsWriteable()

Available

CScript

prefs::set_tags_writeable

comet.prefs.setPanelEnabled(panelID, enabled, message='')

Enable or disable panel interaction. Calls to the function should preferably be made in the after-login script (panelstatement 92). After disconnecting the current data connection, all active locks are canceled.

The blocking of panels serves only to protect against unintentional changes of configuration data.

Parameters
  • panelID (int) – The panel to lock. One of Panel IDs except for comet.kPanelUndef.

  • enabled (bool) –

    Enable or disable the panel?

    • True: Enable the panel.

    • False: Disable the panel.

  • message (str) –

    When enabled is False, this message is displayed on the panel.

    The text is shown behind ‘Panel blocked by’ and must not be empty and not longer than 255 characters.

    Unicode letters are encoded by <0x00FC>.

    If this value starts with the ‘@’ character, the prefix ‘Panel blocked by’ is omitted.

Returns

None

Raises
  • TypeError – When parameter types are invalid.

  • ValueError

    • When parameter panelID has invalid value.

    • When parameter enabled is False and message is empty or too long.

  • CometError – On internal error.

Available

CScript

prefs::enable_panel

comet.prefs.getCScriptBuffer()

Get the current size of the CScript buffer in kB.

Returns

The buffer size.

Return type

int

Available

CScript

prefs::get_script_buffer

comet.prefs.setCScriptBuffer(buffer)

Set the size of the CScript buffer. The changes will take effect from the next script onward. The buffer size is provided in kB and is automatically truncated to the range 1024 - 16384 (1-16 MB).

Parameters

buffer (int) – The buffer size in kB.

Returns

The new actual buffer size in kB.

Return type

int

Raises

TypeError – When parameter types are invalid.

Available

CScript

prefs::set_script_buffer

comet.prefs.getWebImageTimeout(what=0)

Get the timeout for connection to a URL of a web image.

Parameters

what (int) –

Which timeout to get.

  • 0: Connection timeout

  • 1: Header timeout

  • 2: Download timeout

Returns

The timeout in seconds

Return type

float

Raises
  • TypeError – When parameter types are invalid.

  • ValueError – When parameter what has invalid value.

Available

See also

setWebImageTimeout()

CScript
comet.prefs.setWebImageTimeout(value, what=0)

Set the timeout for downloading an URL of a web image.

The internal work for Web Images is done by a software called CURL. There is a default timeout for establishing the connection of 300 seconds. This is a bit long for checking and updating Web Images. We therefore set a default timeout of 3 seconds, which you can be changed using this function.

Alternatively, the timeout for the connection can also be defined by request-timeout in your soapflags.ini.

Parameters
  • value (float) –

    The new value in seconds.

    • <= 0.0: Use the default of 3.0 seconds

  • what (int) –

    Which timeout to set.

    • 0: Connection timeout

    • 1: Header timeout

    • 2: Download timeout

Return type

None

Raises
Available

See also

getWebImageTimeout()

CScript
comet.prefs.getWebImageFolder()

Get the currently set fallback folder for Web Image downloads.

Returns

The fallback folder.

Return type

str

Available

See also

setWebImageFolder()

CScript

prefs::get_urllink_folder

comet.prefs.setWebImageFolder(path)

Set the fallback folder for Web Image downloads.

The path set by this function is only used if panelstatement 141 is empty and is reset at logout time.

Parameters

path (str) – New fallback path for Web Image downloads.

Return type

None

Raises

TypeError – When parameter types are invalid.

Available

See also

getWebImageFolder()

CScript

prefs::set_urllink_folder

comet.prefs.getWebImageProxy(what=0)

Get the current (or soapflags.ini) Proxy settings for web images.

Parameters

what (int) –

What proxy data to get.

  • 0: Current proxy settings.

  • 1: Data from soapflags.ini.

Returns

A dictionary containing the proxy configuration.

The dictionary contains the following entries:

’activated’:

  • Value type: bool

  • Value: Wether the proxy is activated.

’useSoapFlags’:

  • Value type: bool

  • Value: Wether the proxy is using data from soapflags.ini.

’address’:

  • Value type: str

  • Value: Proxy address.

’port’:

  • Value type: int

  • Value: Proxy port.

’user’:

  • Value type: str

  • Value: Proxy user.

’password’:

  • Value type: str

  • Value: Proxy password.

’exceptions’:

  • Value type: list [str]

  • Value: Proxy exceptions.

Return type

dict[str, int | bool | str | list[str]]

Raises

TypeError – When parameter types are invalid.

Available

See also

setWebImageProxy()

CScript

prefs::webimage_get_proxy

comet.prefs.setWebImageProxy(address='off', port=- 1, user='', password='', exceptions=[])

Set the proxy for web images.

Parameters
  • address (str) –

    Proxy-Address (URL or IP).

    • ’default’ or ‘soapflags’

      Use settings from soapflags.ini.

      Please note that soapflags.ini is read at program start and later changes to the file are ignored!

    • ’off’

      Deactivate proxy.

    • else:

      Proxy-Address (URL or IP).

  • port (int) –

    Port for the proxy.

    • <=0: Don’t explicitly use a port.

  • user (str) –

    Username for the proxy.

    • Empty str: Login not necessary.

  • password (str) –

    Unencrypted password for the proxy.

    • Empty str: Login not necessary.

  • exceptions (list[str]) –

    List of exceptions for the proxy.

    See here .

Return type

None

Raises

TypeError – When parameter types are invalid.

Available

See also

getWebImageProxy()

CScript

prefs::webimage_set_proxy

comet.prefs.getUpdateType()

Get the placeholder update behavior.

Returns

The current update behavior.

Return type

int

Available

See also

setUpdateType()

CScript

prefs::get_updatetype

comet.prefs.setUpdateType(type)

Specify the bevahior for handling or determining placeholder content.

Parameters

type (int) –

  • 0: Default behavior. Placeholders are loaded using the current data pool.

  • 1: Store data. Placeholders are loaded using the current data pool.

    After the data has been inserted into the document, the data is additionally stored in the current data folder:

    • If the placeholder is a script, the content of the variable gExportValue is used.

    • On Direct statements (select, get, …) the content of the first column of the first result row is stored.

  • 2: Use update folder.

Please note: The data folder does not have to contain data for all placeholders. But if it contains data for one placeholder, data for all products must be there.

Return type

None

Raises
  • TypeError – When parameter types are invalid.

  • ValueError – When parameter type has invalid value.

Available

See also

getUpdateType()

CScript

prefs::set_updatetype

comet.prefs.getUpdatePath()

Get the current folder for loading locally stored placeholder content.

Returns

The full path to the update folder.

Return type

str

Available

See also

setUpdatePath()

CScript

prefs::get_updatepath

comet.prefs.setUpdatePath(path)

Set the folder for loading stored placeholder content from.

The folder is only used when update type 2 (‘Use data’) is active.

Parameters

path (str) – The full path to the update folder.

Return type

None

Raises

TypeError – When parameter types are invalid.

Available

See also

getUpdatePath()

CScript

prefs::set_updatepath

comet.prefs.getDocWatch()

Fetch the current document watch state.

Returns

The document watch state.

Return type

bool

Available

See also

setDocWatch()

CScript

system::get_docwatch

comet.prefs.setDocWatch(state)

Enable/disable the document watch. When document watch is enabled, the system attempts to load and execute the document watch panel statements.

Document watch is automatically disabled when the data connection is disconnected (database logout, SOAP logout, change XML folder).

The call should be made in the login script of the data connection.

Parameters

state (bool) –

The new document watch state.

Return type

None

Raises

TypeError – When parameter types are invalid.

Available

See also

getDocWatch()

CScript

system::set_docwatch

comet.prefs.getMagnetState()

Ascertain for which situations magnets are currently activated.

Returns

The active situations as bit flags.

Sum of Magnet situations

Return type

int

Available

See also

setMagnetState()

CScript

prefs::enable_magnets

comet.prefs.setMagnetState(situation, state)

Disable or enable magnets for certain situations. On program start all situations are enabled.

Disabling individual situations should only ever be used for a short time and should be reversed as soon as possible.

Parameters
Return type

None

Raises
  • TypeError – When parameter types are invalid.

  • ValueError – When parameter state has invalid value.

Available

See also

getMagnetState()

CScript

prefs::enable_magnets

comet.prefs.getLayoutRulesState()

Ascertain the state of the currently active layout rule situations.

Returns

A bit flag value indicating which situations are active.

Can be bitwise checked against values of Layout rule situations

Return type

int

Available

See also

setLayoutRulesState()

CScript

system::suppress_layout_rules

comet.prefs.setLayoutRulesState(situation, state)

Enable/disable certain layout rule situations.

This setting is global and is active until the next call to this function or until the currently active data connection is changed.

You should take strict care to turn layout rules that you have turned off back on. Otherwise, the building and updating of your documents may no longer be executed correctly.

Parameters
Return type

None

Raises

TypeError – When parameter types are invalid.

Available

See also

getLayoutRulesState()

CScript

system::suppress_layout_rules

comet.prefs.getLayoutRuleState(ruleID)

Determine whether a single layout rule is suppressed from execution.

Parameters

ruleID (int) –

The ID of the rule to query.

The default layout rule IDs can be found here:

Returns

Whether the rule is active (True) or suppressed (False)

Return type

bool

Raises

TypeError – When parameter types are invalid.

Available

See also

setLayoutRulesState()

CScript

system::suppress_layout_rule

comet.prefs.setLayoutRuleState(ruleID, state)

Set whether a single layout rule should be suppressed from execution.

Parameters
  • ruleID (int) –

    The ID of the rule.

    The default layout rule IDs can be found here:

  • state (bool) –

    Whether to suppress the rule

    • True: Do not suppress the rule

    • False: Suppress the rule

Return type

None

Raises

TypeError – When parameter types are invalid.

Available

See also

setLayoutRulesState()

CScript

system::suppress_layout_rule

comet.prefs.getSnippetMatch()

Get the standard snippet match criteria.

The value is reset automatically at logout time.

Usually, this value is set in a login script (panelstatement 92).

Returns

Arbitrary combination of snippet match criteria.

Sum of Snippet match settings

Return type

int

Available

See also

setSnippetMatch()

CScript

prefs::snippet_match

comet.prefs.setSnippetMatch(value)

Get the standard snippet match criteria.

The value is reset automatically at logout time.

Usually, this value is set in a login script (panelstatement 92).

Parameters

value (int) –

Arbitrary combination of snippet match criteria.

Sum of Snippet match settings

Return type

None

Raises
Available

See also

getSnippetMatch()

CScript

prefs::snippet_match

comet.prefs.getLogState(what=1)

Get the state of writing additional log information.

Parameters

what (int) –

Which additional log information state to query.

  • 1: Get state for log information about inserting TaggedText

  • 2: Single steps of frame fitting

Returns

The logging state.

  • what == 1:
    • 0: Disabled

    • 1: Enabled

    • 2: Write line delimiters as \n and \r

  • what == 2:
    • 0: Disabled

    • 1: Enabled

Return type

int

Raises
  • TypeError – When parameter types are invalid.

  • ValueError – When parameter what has invalid value.

Available

See also

setLogState()

CScript

prefs::set_logstate

comet.prefs.setLogState(what=1, how=1)

Set the state of writing additional log information.

With the menu command Plug-Ins -> Comet -> More Log Output you can switch on and off all additional log outputs.

Additional log messages should only be activated for a short time. Writing the messages can take a long time and significantly reduce performance. Very large log files may be involved.

If additional log messages are written, confidential customer data can be written to the log file!

The additional log messages are automatically switched off again after restarting the host application.

Parameters
  • what (int) –

    Which additional log information state to set.

    • 1: Log information about inserting TaggedText

    • 2: Single steps of frame fitting

  • how (int) –

    The logging state.

    • what == 1:
      • 0: Disabled

      • 1: Enabled

      • 2: Write line delimiters as \n and \r

    • what == 2:
      • 0: Disabled

      • 1: Enabled

Return type

None

Raises
  • TypeError – When parameter types are invalid.

  • ValueError

    • When parameter what has invalid value.

    • When parameter how has invalid value.

Available

See also

getLogState()

CScript

prefs::set_logstate

comet.prefs.getShowURLProgress()

Determine whether a progress bar should be shown for Web image downloads.

The setting has no meaning for the manual creation and updating of web images via the Web Images panel or the Web Images context menu.

Returns

Whether the progress bar is shown on download.

Return type

bool

Available

CScript

prefs::show_url_progress

comet.prefs.setShowURLProgress(value)

Set whether a progress bar should be shown for Web image downloads.

Parameters

value (bool) – Whether the progress bar should be shown on download.

Return type

None

Raises

TypeError – When parameter types are invalid.

Available

CScript

prefs::show_url_progress