gui/backend/gui_plugin/modules/Modules.py
def update_data(id, caption=None, content=None, web_session=None):
    """Update data at the given module

    Args:
        id (int): The id of the data
        caption (str): Caption
        content (str): The content data
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

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

    with BackendDatabase(web_session) as db:
        with BackendTransaction(db):
            privileges = backend.get_user_privileges_for_data(db, id, web_session.user_id)
            if any([p['read_only'] == 0 for p in privileges]):
                actions=[]
                args=tuple()

                if caption:
                    actions.append("caption=?")
                    args += (caption,)
                if content:
                    actions.append("content=?")
                    args += (json.dumps(content),)

                db.execute("UPDATE data SET " + ",".join(actions) +
                            " WHERE id=?", args + (id,))
            else:
                raise MSGException(Error.MODULES_USER_HAVE_NO_PRIVILEGES, "User have no privileges to perform operation.")

            return id
Update data at the given module

    Args:
        id (int): The id of the data
        caption (str): Caption
        content (str): The content data
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

    Returns:
        The id of the updated record..
    
Update data at the given module
Update data at the given module
def update_data(id, caption=None, content=None, web_session=None):
    with BackendDatabase(web_session) as db:
        with BackendTransaction(db):
            privileges = backend.get_user_privileges_for_data(db, id, web_session.user_id)
            if any([p['read_only'] == 0 for p in privileges]):
                actions=[]
                args=tuple()
                if caption:
                    actions.append("caption=?")
                    args += (caption,)
                if content:
                    actions.append("content=?")
                    args += (json.dumps(content),)
                db.execute("UPDATE data SET " + ",".join(actions) +
                            " WHERE id=?", args + (id,))
            else:
                raise MSGException(Error.MODULES_USER_HAVE_NO_PRIVILEGES, "User have no privileges to perform operation.")
            return id
def update_data ( id , caption = None , content = None , web_session = None ) : with BackendDatabase ( web_session ) as db : with BackendTransaction ( db ) : privileges = backend . get_user_privileges_for_data ( db , id , web_session . user_id ) if any ( [ p [ 'read_only' ] == 0 for p in privileges ] ) : actions = [ ] args = tuple ( ) if caption : actions . append ( "caption=?" ) args += ( caption , ) if content : actions . append ( "content=?" ) args += ( json . dumps ( content ) , ) db . execute ( "UPDATE data SET " + "," . join ( actions ) + " WHERE id=?" , args + ( id , ) ) else : raise MSGException ( Error . MODULES_USER_HAVE_NO_PRIVILEGES , "User have no privileges to perform operation." ) return id
Update data at the given module
Update data at the given module
"""Update data at the given module

    Args:
        id (int): The id of the data
        caption (str): Caption
        content (str): The content data
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

    Returns:
        The id of the updated record..
    """
The id of the updated record
The id of the updated record
id
The id of the data
The id of the data
caption
None
content
The content data
The content data
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