Skip to content

CxTowerFileTemplate

File template to manage multiple files at once

Method create_file

Create a new file using the current template for the selected server. If the same file already exists, just ignore it or raise an error based on the parameter.

:param server: recordset The server (cx.tower.server) on which the file should be created. This is a required parameter. :param if_file_exists: str, optional Defines the behavior if the file already exists on the server. :param server_dir: str, optional The directory on the server where the file should be created. If not set, the server_dir field of the template will be used. :param jet_template: cx.tower.jet.template, optional The jet template to use for creating the new file. :param jet: cx.tower.jet, optional The jet to use for creating the new file.

:return: cx.tower.file Returns the newly created file record (cx.tower.file) if the file was created successfully or if_file_exists is set to "overwrite". Returns the existing file record if the file already exists and if_file_exists is set to "skip".

:raises ValidationError: If the file already exists on the server if_file_exists is set to "raise".