gui/backend/gui_plugin/core/Files.py
def create_file(path, web_session=None):
    """Creates a new file specified by the path.

    If running in multi-user mode, the directory is relative to the user space and requests
    outside the user space will result in error.
    If running in single-user mode, absolute paths area allowed, but if a relative path is
    supplied, then it will be relative to the system user home directory.
    If the path starts with "." or "./" it will be resolved as the root to the relative
    path in the running mode.

    The file type to be created is determined by the file extension.
    The supported file types are as follows:
        - SQLITE (use the .sqlite or .sqlite3 extensions)

    Args:
        path (str): The path and file name relative to the user space
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

    Returns:
        The path to the created file on success.
    """

    if path == "":
        raise MSGException(Error.CORE_PATH_NOT_SUPPLIED,
                            "The supplied path is empty.")

    # the rel_path is the full_path on local sessions
    full_path, rel_path = resolve_path(path, web_session)

    if os.path.isdir(full_path):
        raise MSGException(Error.CORE_NOT_FILE,
                            "The supplied path is not a file.")

    if not os.access(os.path.dirname(full_path), os.W_OK):
        raise MSGException(Error.CORE_PERMISSION_DENIED,
                            "No permissions to access the directory.")

    if os.path.exists(full_path):
        raise MSGException(Error.CORE_PATH_ALREADY_EXISTS,
                            "The supplied file already exists.")

    if full_path.endswith(".sqlite") or full_path.endswith(".sqlite3"):
        conn = sqlite3.connect(full_path)
        conn.close()
    else:
        raise MSGException(Error.CORE_INVALID_EXTENSION,
                            "The file does not have a valid extension.")

    result = Response.ok("The file was created", {
        "result": rel_path
    })

    return result
Creates a new file specified by the path.

    If running in multi-user mode, the directory is relative to the user space and requests
    outside the user space will result in error.
    If running in single-user mode, absolute paths area allowed, but if a relative path is
    supplied, then it will be relative to the system user home directory.
    If the path starts with "." or "./" it will be resolved as the root to the relative
    path in the running mode.

    The file type to be created is determined by the file extension.
    The supported file types are as follows:
        - SQLITE (use the .sqlite or .sqlite3 extensions)

    Args:
        path (str): The path and file name relative to the user space
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

    Returns:
        The path to the created file on success.
    
Creates a new file specified by the path.
If running in multi-user mode, the directory is relative to the user space and requests
outside the user space will result in error.
If running in single-user mode, absolute paths area allowed, but if a relative path is
supplied, then it will be relative to the system user home directory.
If the path starts with "." or "./" it will be resolved as the root to the relative
path in the running mode.

The file type to be created is determined by the file extension.
The supported file types are as follows:
SQLITE (use the .sqlite or .sqlite3 extensions)
Creates a new file specified by the path . If running in multi - user mode the directory is relative to the user space and requests outside the user space will result in error . If running in single - user mode absolute paths area allowed but if a relative path is supplied then it will be relative to the system user home directory . If the path starts with " . " or " . / " it will be resolved as the root to the relative path in the running mode . The file type to be created is determined by the file extension . The supported file types are as follows : SQLITE ( use the . sqlite or . sqlite3 extensions )
def create_file(path, web_session=None):
    if path == "":
        raise MSGException(Error.CORE_PATH_NOT_SUPPLIED,
                            "The supplied path is empty.")
    full_path, rel_path = resolve_path(path, web_session)
    if os.path.isdir(full_path):
        raise MSGException(Error.CORE_NOT_FILE,
                            "The supplied path is not a file.")
    if not os.access(os.path.dirname(full_path), os.W_OK):
        raise MSGException(Error.CORE_PERMISSION_DENIED,
                            "No permissions to access the directory.")
    if os.path.exists(full_path):
        raise MSGException(Error.CORE_PATH_ALREADY_EXISTS,
                            "The supplied file already exists.")
    if full_path.endswith(".sqlite") or full_path.endswith(".sqlite3"):
        conn = sqlite3.connect(full_path)
        conn.close()
    else:
        raise MSGException(Error.CORE_INVALID_EXTENSION,
                            "The file does not have a valid extension.")
    result = Response.ok("The file was created", {
        "result": rel_path
    })
    return result
def create_file ( path , web_session = None ) : if path == "" : raise MSGException ( Error . CORE_PATH_NOT_SUPPLIED , "The supplied path is empty." ) full_path , rel_path = resolve_path ( path , web_session ) if os . path . isdir ( full_path ) : raise MSGException ( Error . CORE_NOT_FILE , "The supplied path is not a file." ) if not os . access ( os . path . dirname ( full_path ) , os . W_OK ) : raise MSGException ( Error . CORE_PERMISSION_DENIED , "No permissions to access the directory." ) if os . path . exists ( full_path ) : raise MSGException ( Error . CORE_PATH_ALREADY_EXISTS , "The supplied file already exists." ) if full_path . endswith ( ".sqlite" ) or full_path . endswith ( ".sqlite3" ) : conn = sqlite3 . connect ( full_path ) conn . close ( ) else : raise MSGException ( Error . CORE_INVALID_EXTENSION , "The file does not have a valid extension." ) result = Response . ok ( "The file was created" , { "result" : rel_path } ) return result
Creates a new file specified by the path.
Creates a new file specified by the path .
"""Creates a new file specified by the path.

    If running in multi-user mode, the directory is relative to the user space and requests
    outside the user space will result in error.
    If running in single-user mode, absolute paths area allowed, but if a relative path is
    supplied, then it will be relative to the system user home directory.
    If the path starts with "." or "./" it will be resolved as the root to the relative
    path in the running mode.

    The file type to be created is determined by the file extension.
    The supported file types are as follows:
        - SQLITE (use the .sqlite or .sqlite3 extensions)

    Args:
        path (str): The path and file name relative to the user space
        web_session (object): The webserver session object, optional. Will be
            passed in my the webserver automatically

    Returns:
        The path to the created file on success.
    """ # the rel_path is the full_path on local sessions
The path to the created file on success.
The path to the created file on success .
path
The path and file name relative to the user space
The path and file name relative to the user space
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