gui/backend/gui_plugin/modules/Modules.py
def list_data_categories(category_id=None, web_session=None):
    """Gets the list of available data categories and sub categories
       for the given name.

    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 list of available data categories
    """
    with BackendDatabase(web_session) as db:
        if category_id is None:
            res = db.select("""SELECT id, name, parent_category_id
                            FROM data_category
                            WHERE parent_category_id is NULL""",())
        else:
            res = db.select("""WITH RECURSIVE
                                categories(id, name, parent_category_id) AS (
                                    SELECT id, name, parent_category_id FROM data_category
                                        WHERE id=?
                                    UNION ALL
                                    SELECT dc.id, dc.name, dc.parent_category_id
                                        FROM categories c
                                        JOIN data_category dc ON c.id=dc.parent_category_id
                                )
                                SELECT DISTINCT id, name, parent_category_id FROM categories""",
                                (category_id,))
            if not res["rows"]:
                raise MSGException(Error.MODULES_INVALID_DATA_CATEGORY, "Data category does not exist.")

        status = db.get_last_status()
        if status['type'] != "OK":
            raise MSGException(Error.DB_ERROR, status['msg'])

        return res["rows"] if res else []
Gets the list of available data categories and sub categories
       for the given name.

    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 list of available data categories
    
Gets the list of available data categories and sub categories
for the given name.
Gets the list of available data categories and sub categories for the given name .
def list_data_categories(category_id=None, web_session=None):
    with BackendDatabase(web_session) as db:
        if category_id is None:
            res = db.select("""SELECT id, name, parent_category_id
                            FROM data_category
                            WHERE parent_category_id is NULL""",())
        else:
            res = db.select("""WITH RECURSIVE
                                categories(id, name, parent_category_id) AS (
                                    SELECT id, name, parent_category_id FROM data_category
                                        WHERE id=?
                                    UNION ALL
                                    SELECT dc.id, dc.name, dc.parent_category_id
                                        FROM categories c
                                        JOIN data_category dc ON c.id=dc.parent_category_id
                                )
                                SELECT DISTINCT id, name, parent_category_id FROM categories""",
                                (category_id,))
            if not res["rows"]:
                raise MSGException(Error.MODULES_INVALID_DATA_CATEGORY, "Data category does not exist.")
        status = db.get_last_status()
        if status['type'] != "OK":
            raise MSGException(Error.DB_ERROR, status['msg'])
        return res["rows"] if res else []
def list_data_categories ( category_id = None , web_session = None ) : with BackendDatabase ( web_session ) as db : if category_id is None : res = db . select ( """SELECT id, name, parent_category_id
                            FROM data_category
                            WHERE parent_category_id is NULL""" , ( ) ) else : res = db . select ( """WITH RECURSIVE
                                categories(id, name, parent_category_id) AS (
                                    SELECT id, name, parent_category_id FROM data_category
                                        WHERE id=?
                                    UNION ALL
                                    SELECT dc.id, dc.name, dc.parent_category_id
                                        FROM categories c
                                        JOIN data_category dc ON c.id=dc.parent_category_id
                                )
                                SELECT DISTINCT id, name, parent_category_id FROM categories""" , ( category_id , ) ) if not res [ "rows" ] : raise MSGException ( Error . MODULES_INVALID_DATA_CATEGORY , "Data category does not exist." ) status = db . get_last_status ( ) if status [ 'type' ] != "OK" : raise MSGException ( Error . DB_ERROR , status [ 'msg' ] ) return res [ "rows" ] if res else [ ]
Gets the list of available data categories and sub categories
for the given name.
Gets the list of available data categories and sub categories for the given name .
"""Gets the list of available data categories and sub categories
       for the given name.

    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 list of available data categories
    """
The list of available data categories
The list of available data categories
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