Script Reference
The scripts
Module
Console scripts.
- class chrysalio.scripts.Script(args, create_all, includes=None, dbsession_factory=None)[source]
Base class for a script which reads the INI file and interacts with the database.
- Parameters:
args (argparse.Namespace) – Command line arguments.
create_all (bool) – If
True
, it creates all the tables, otherwise, it checks if the tableusers
exists with at least one user.includes (list) – (optional) List of hard coding includes.
dbsession_factory (sqlalchemy.orm.session.sessionmaker) – (optional) Function to create session.
- classmethod argument_parser(description)[source]
Create an argument parser object to parse command line arguments.
- Parameters:
description (str) – Description of the script.
- Return type:
- classmethod arguments(parser, args=None, filemode='w')[source]
Retrieve arguments from parser, check them and setup logging.
- Parameters:
parser (argparse.ArgumentParser) – Configuration parser object.
args (list) – (optional) Command line arguments (for testing).
filemode (str) – File mode for logging (
'w'
or'a'
).
- Return type:
The scripts.ciopopulate
Script
Populate the database and the attachment directory.
- class chrysalio.scripts.ciopopulate.Populate(args, dbuser_class, _xml2db, relaxng, includes=None, dbsession_factory=None)[source]
Class to populate database.
- Parameters:
args (argparse.Namespace) – Command line arguments.
dbuser_class – Class to manage user SQL table.
_xml2db (function) – Function to load XML configuration files. See
xml2db()
.relaxng (dict) – A dictionary describing the main Relax NG with the following keys:
'root'
,'version'
and'file'
.includes (list) – (optional) List of hard coding includes.
dbsession_factory (sqlalchemy.orm.session.sessionmaker) – (optional) Function to create session.
The scripts.ciobackup
Script
Backup database into an XML file.
- class chrysalio.scripts.ciobackup.Backup(args, _db2xml, relaxng, includes=None, dbsession_factory=None)[source]
Class to backup database.
- Parameters:
args (argparse.Namespace) – Command line arguments.
_db2xml (function) – Function to save database fields into XML elements. See
db2xml()
.relaxng (dict) – A dictionary describing the main Relax NG with the following keys:
'root'
,'version'
and'file'
.includes (list) – (optional) List of hard coding includes.
dbsession_factory (sqlalchemy.orm.session.sessionmaker) – (optional) Function to create session.
The scripts.cioupdate
Script
Console script to backup and update Chrysalio sites.