comet.datapool¶
The comet.datapool module provides global connection access for the current session and facilities to establish the global comet data connection.
Methods¶
- comet.datapool.getConnection()¶
Get the current global data connection if it is established.
- Returns:
The active data connection
The type is dependant of the connection itself:
- Return type:
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- Examples:
Get the current data connection and log information based on the type of connection.
#!py #pragma plain import comet def main(): connection = comet.datapool.getConnection() if not connection: comet.wlog('Not connected') else: comet.wlog('Connection:') if isinstance(connection, str): #XML Pool comet.wlog( f'\t Type: XML' f'\n\t Path: {connection}' ) elif isinstance(connection, comet.CSOAP): #SOAP comet.wlog( f'\t Type: SOAP' f'\n\t Server: {connection.getServer()}' f'\n\t User: {connection.getUser()}' f'\n\t Language: {connection.getLanguage()}' f'\n\t Client: {connection.getClient()}' ) elif isinstance(connection, comet.CSQL): #SQL comet.wlog( f'\t Type: CSQL' f'\n\t Server: {connection.getServer()}' f'\n\t User: {connection.getUser()}' f'\n\t DB Name: {connection.getDBName()}' f'\n\t Client: {connection.getClient()}' f'\n\t Charset: {connection.getCharset()}' ) return 0
- comet.datapool.getSessionID()¶
Get the session ID of the current publishing server connection.
- Returns:
The session ID if available, else empty str.
- Return type:
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- comet.datapool.loginSOAP(host, user='', password='', language='', client='', lazy=True)¶
Establish the global data connection by connecting to a SOAP service, e.g. a publishing server.
- Parameters:
- Returns:
The new connection
- Return type:
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter host is empty.
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- Examples:
Log into a local publishing server.
comet.datapool.loginSOAP('http://localhost:40080/CometBridge/Comet3Service', 'admin', 'admin', client = 'demoID')
- comet.datapool.loginDB(host, user='', password='', database='', client='', lazy=True)¶
Establish the global data connection by connecting to an SQL database.
- Parameters:
- Returns:
The new connection
- Return type:
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter host is empty.
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- Examples:
Log into a local database.
comet.datapool.loginDB('localhost:3306', 'root', 'root', 'comet_config')
- comet.datapool.loginXML(path)¶
Establish the global data connection by connecting to a local XML pool.
- Parameters:
path (str) – The path to the local XML pool
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
ValueError – When parameter path is empty.
CometError – On internal error
- Available:
InDesign® comet_pdf® Illustrator®
- CScript:
- Examples:
Log into an XML pool on the desktop.
comet.datapool.loginXML(comet.uncurtain('$DESKTOP/DemoPool'))
- comet.datapool.logout()¶
Disconnect the global data connection.
- Return type:
None
- CScript: