gui/backend/gui_plugin/modules/Modules.py
def remove_data_category(category_id, web_session=None):
    """Remove a data category from the list of available data categories for this module

    Args:
        category_id (int): The id of the data category
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically


    Returns:
        The id of the removed category.
    """
    if category_id <= 100:
        raise MSGException(Error.MODULES_CANT_DELETE_MODULE_CATEGORY, "Can't delete predefined data category.")

    with BackendDatabase(web_session) as db:
        res = db.execute("""SELECT data_category_id
                                FROM data
                                WHERE data_category_id=?
                            LIMIT 1""",
                            (category_id,)).fetch_all()
        if res:
            raise MSGException(Error.MODULES_CANT_DELETE_MODULE_CATEGORY, "Can't delete data category associated with data.")

        res = db.execute("""SELECT id
                                FROM data_category
                                WHERE parent_category_id=?
                            LIMIT 1""",
                            (category_id,)).fetch_all()
        if res:
            raise MSGException(Error.MODULES_CANT_DELETE_MODULE_CATEGORY, "Can't delete data category associated with sub categories.")

        db.execute("""DELETE FROM data_category
                      WHERE id=?""",
                      (category_id,)).fetch_one()

        if db.rows_affected == 0:
            raise MSGException(Error.MODULES_INVALID_DATA_CATEGORY, "Data category does not exist.")

        return category_id
Remove a data category from the list of available data categories for this module

    Args:
        category_id (int): The id of the data category
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically


    Returns:
        The id of the removed category.
    
Remove a data category from the list of available data categories for this module
Remove a data category from the list of available data categories for this module
def remove_data_category(category_id, web_session=None):
    if category_id <= 100:
        raise MSGException(Error.MODULES_CANT_DELETE_MODULE_CATEGORY, "Can't delete predefined data category.")
    with BackendDatabase(web_session) as db:
        res = db.execute("""SELECT data_category_id
                                FROM data
                                WHERE data_category_id=?
                            LIMIT 1""",
                            (category_id,)).fetch_all()
        if res:
            raise MSGException(Error.MODULES_CANT_DELETE_MODULE_CATEGORY, "Can't delete data category associated with data.")
        res = db.execute("""SELECT id
                                FROM data_category
                                WHERE parent_category_id=?
                            LIMIT 1""",
                            (category_id,)).fetch_all()
        if res:
            raise MSGException(Error.MODULES_CANT_DELETE_MODULE_CATEGORY, "Can't delete data category associated with sub categories.")
        db.execute("""DELETE FROM data_category
                      WHERE id=?""",
                      (category_id,)).fetch_one()
        if db.rows_affected == 0:
            raise MSGException(Error.MODULES_INVALID_DATA_CATEGORY, "Data category does not exist.")
        return category_id
def remove_data_category ( category_id , web_session = None ) : if category_id <= 100 : raise MSGException ( Error . MODULES_CANT_DELETE_MODULE_CATEGORY , "Can't delete predefined data category." ) with BackendDatabase ( web_session ) as db : res = db . execute ( """SELECT data_category_id
                                FROM data
                                WHERE data_category_id=?
                            LIMIT 1""" , ( category_id , ) ) . fetch_all ( ) if res : raise MSGException ( Error . MODULES_CANT_DELETE_MODULE_CATEGORY , "Can't delete data category associated with data." ) res = db . execute ( """SELECT id
                                FROM data_category
                                WHERE parent_category_id=?
                            LIMIT 1""" , ( category_id , ) ) . fetch_all ( ) if res : raise MSGException ( Error . MODULES_CANT_DELETE_MODULE_CATEGORY , "Can't delete data category associated with sub categories." ) db . execute ( """DELETE FROM data_category
                      WHERE id=?""" , ( category_id , ) ) . fetch_one ( ) if db . rows_affected == 0 : raise MSGException ( Error . MODULES_INVALID_DATA_CATEGORY , "Data category does not exist." ) return category_id
Remove a data category from the list of available data categories for this module
Remove a data category from the list of available data categories for this module
"""Remove a data category from the list of available data categories for this module

    Args:
        category_id (int): The id of the data category
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically


    Returns:
        The id of the removed category.
    """
The id of the removed category.
The id of the removed category .
category_id
The id of the data category
The id of the data category
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