gui/backend/gui_plugin/modules/Modules.py
def add_data(caption, content, data_category_id, tree_identifier, folder_path=None, profile_id=None, web_session=None):
    """Creates a new Module Data record for the given module
       and associates it to the active user profile and personal user group.

    Args:
        caption (str): The data caption
        content (str): The content of data module
        data_category_id (int): The id of data category
        tree_identifier (str): The identifier of the tree
        folder_path (str): The folder path f.e. "/scripts/server1"
        profile_id (int): The id of profile
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

    Returns:
        The id of the new record.
    """

    if caption.strip() == "":
        raise MSGException(Error.CORE_INVALID_PARAMETER, f"Parameter 'caption' cannot be empty.")

    if tree_identifier.strip() == "":
        raise MSGException(Error.CORE_INVALID_PARAMETER, f"Parameter 'tree_identifier' cannot be empty.")

    if folder_path.strip() == "" or folder_path.strip() == "/":
        folder_path = None

    with BackendDatabase(web_session) as db:
        with BackendTransaction(db):
            db.execute('''INSERT INTO data (data_category_id, caption,
                            content, created, last_update)
                            VALUES(?, ?, ?, ?, ?)''',
                       (data_category_id,
                        caption,
                        json.dumps(content),
                        datetime.datetime.now(),
                        datetime.datetime.now()))

            id = db.get_last_row_id()

            backend.add_data_associations(db,
                                          id,
                                          tree_identifier,
                                          folder_path,
                                          profile_id if profile_id else web_session.session_active_profile_id,
                                          web_session.user_personal_group_id)

            return id
Creates a new Module Data record for the given module
       and associates it to the active user profile and personal user group.

    Args:
        caption (str): The data caption
        content (str): The content of data module
        data_category_id (int): The id of data category
        tree_identifier (str): The identifier of the tree
        folder_path (str): The folder path f.e. "/scripts/server1"
        profile_id (int): The id of profile
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

    Returns:
        The id of the new record.
    
Creates a new Module Data record for the given module
and associates it to the active user profile and personal user group.
Creates a new Module Data record for the given module and associates it to the active user profile and personal user group .
def add_data(caption, content, data_category_id, tree_identifier, folder_path=None, profile_id=None, web_session=None):
    if caption.strip() == "":
        raise MSGException(Error.CORE_INVALID_PARAMETER, f"Parameter 'caption' cannot be empty.")
    if tree_identifier.strip() == "":
        raise MSGException(Error.CORE_INVALID_PARAMETER, f"Parameter 'tree_identifier' cannot be empty.")
    if folder_path.strip() == "" or folder_path.strip() == "/":
        folder_path = None
    with BackendDatabase(web_session) as db:
        with BackendTransaction(db):
            db.execute('''INSERT INTO data (data_category_id, caption,
                            content, created, last_update)
                            VALUES(?, ?, ?, ?, ?)''',
                       (data_category_id,
                        caption,
                        json.dumps(content),
                        datetime.datetime.now(),
                        datetime.datetime.now()))
            id = db.get_last_row_id()
            backend.add_data_associations(db,
                                          id,
                                          tree_identifier,
                                          folder_path,
                                          profile_id if profile_id else web_session.session_active_profile_id,
                                          web_session.user_personal_group_id)
            return id
def add_data ( caption , content , data_category_id , tree_identifier , folder_path = None , profile_id = None , web_session = None ) : if caption . strip ( ) == "" : raise MSGException ( Error . CORE_INVALID_PARAMETER , f"Parameter 'caption' cannot be empty." ) if tree_identifier . strip ( ) == "" : raise MSGException ( Error . CORE_INVALID_PARAMETER , f"Parameter 'tree_identifier' cannot be empty." ) if folder_path . strip ( ) == "" or folder_path . strip ( ) == "/" : folder_path = None with BackendDatabase ( web_session ) as db : with BackendTransaction ( db ) : db . execute ( '''INSERT INTO data (data_category_id, caption,
                            content, created, last_update)
                            VALUES(?, ?, ?, ?, ?)''' , ( data_category_id , caption , json . dumps ( content ) , datetime . datetime . now ( ) , datetime . datetime . now ( ) ) ) id = db . get_last_row_id ( ) backend . add_data_associations ( db , id , tree_identifier , folder_path , profile_id if profile_id else web_session . session_active_profile_id , web_session . user_personal_group_id ) return id
Creates a new Module Data record for the given module
and associates it to the active user profile and personal user group.
Creates a new Module Data record for the given module and associates it to the active user profile and personal user group .
"""Creates a new Module Data record for the given module
       and associates it to the active user profile and personal user group.

    Args:
        caption (str): The data caption
        content (str): The content of data module
        data_category_id (int): The id of data category
        tree_identifier (str): The identifier of the tree
        folder_path (str): The folder path f.e. "/scripts/server1"
        profile_id (int): The id of profile
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

    Returns:
        The id of the new record.
    """
The id of the new record.
The id of the new record .
caption
The data caption
The data caption
content
The content of data module
The content of data module
data_category_id
The id of data category
The id of data category
tree_identifier
The identifier of the tree
The identifier of the tree
folder_path
The folder path f.e. "/scripts/server1"
The folder path f . e . " / scripts / server1 "
profile_id
The id of profile
The id of profile
web_session
The webserver session object, optional. Will be
passed in my the webserver automatically
The webserver session object optional . Will be passed in my the webserver automatically