kepler.scripts.initializedb module

The module is the database initialization script. It creates the database tables and inserts all constant values to them.

kepler.scripts.initializedb.add_constants(languages)

The function adds several constants to the database.

kepler.scripts.initializedb.add_enum(lang_en, enum, table)

The function adds an enumeration type as constants to the specified database table.

kepler.scripts.initializedb.add_enum_value(enum_value, table)

The function adds a single enumeration value to the specified database table. The table model class is assumed to have id and name_tr_id ad initializer parameters.

kepler.scripts.initializedb.add_enum_value2(enum_value, table)

The function adds a single enumeration value to the specified database table.

kepler.scripts.initializedb.add_permissions()

The function adds all permission constants to the Permission database table.

kepler.scripts.initializedb.add_permissions_to_role(role, permissions)

The function adds permissions to the speciied role.

kepler.scripts.initializedb.add_resource(name_tr, description_tr=None)

The function adds a new resource status type to the database.

Parameters:
  • name_tr – The string representing the translation ID of the name of the resource.
  • description_tr – The string representing the translation ID of the description of the resource.
Returns:

The new resource.

kepler.scripts.initializedb.add_resource_status_type(name_tr)

The function adds a new resource status type to the database.

Parameters:name_tr – The string representing the translation ID of the name of the resource status type.
Returns:The new resource status type.
kepler.scripts.initializedb.add_resources_to_status(resource, status_type_id, count)

The function adds ResourcesStatus table row to the database.

Parameters:
  • resource – The resource of the row.
  • resource – The resource status type of the row.
  • count – The number of resources.
Returns:

The new ResourcesStatus row.

kepler.scripts.initializedb.add_transl(lang, tr_name, translation)

The function is a shortcut for the translations.add_translation function.

kepler.scripts.initializedb.add_unit(unit_name_tr, max_user_group_size, description_tr=None)

The function adds a unit to the database.

Parameters:
  • unit_name_tr – The string representing the translation ID of the name of the unit.
  • max_user_group_size – The upper limit of the size for the user group to be able to reserve the unit.
  • description_tr – The optional string representing the translation ID of the description of the unit.
Returns:

The new unit.

kepler.scripts.initializedb.add_unit_group(unit_group_name_tr, unit_type)

The function adds a unit group to the database.

Parameters:
  • unit_group_name_tr – The string representing the translation ID of the name of the unit group.
  • unit_type – The unit type of the unit group.
Returns:

The new unit group.

kepler.scripts.initializedb.add_unit_to_group(unit, unit_group, qualifier)

The function adds a unit to a unit group.

Parameters:
  • unit – The unit added to the unit group.
  • unit_group – The unit group in which the unit is added.
  • qualifier – The qualifier for the unit in the unit group.
kepler.scripts.initializedb.add_unit_type(unit_type_name_tr)

The function adds a unit type to the database.

Parameters:unit_type_name_tr – The string representing the translation ID of the name of the unit type.
Returns:The new unit type.
kepler.scripts.initializedb.main(argv=['D:\\Ohjelmat\\Python34\\Scripts\\sphinx-build', '-b', 'html', '-d', '_build/doctrees', '.', '_build/html'])

The entry point of the database initialization script. The script creates and initializes the database tables, and adds some test data to the database.

kepler.scripts.initializedb.usage(argv)

The function prints the usage advice of the database initialization script and exits the program.