bversion/server.py
def delete_files(request: Request, context: ConnectionContext) -> Responce:
    """ Delete one or more files from the server """

    session_token = request.headers['session_token'].encode('utf8')
    repository    = request.headers['repository']

    #===
    current_user = have_authenticated_user(request.remote_addr, repository, session_token)
    if current_user is False: return fail(user_auth_fail_msg)

    #===
    repository_path = config['repositories'][repository]['path']
    body_data = request.get_json()

    #===
    if not context.lock:
        return fail(lock_fail_msg)

    #===
    try:
        data_store = versioned_storage(repository_path,
                                       path_override = config['repositories'][repository]['transient_db_path_override'])

        if data_store.get_active_commit() is None: return fail(no_active_commit_msg)

        #-------------
        to_delete = json.loads(body_data['files'])
        data_store.fs_delete(to_delete)

        return success()

    except Exception: # pylint: disable=broad-except
        return fail()
 Delete one or more files from the server 
Delete one or more files from the server
Delete one or more files from the server
def delete_files(request: Request, context: ConnectionContext) -> Responce:
    session_token = request.headers['session_token'].encode('utf8')
    repository    = request.headers['repository']
    current_user = have_authenticated_user(request.remote_addr, repository, session_token)
    if current_user is False: return fail(user_auth_fail_msg)
    repository_path = config['repositories'][repository]['path']
    body_data = request.get_json()
    if not context.lock:
        return fail(lock_fail_msg)
    try:
        data_store = versioned_storage(repository_path,
                                       path_override = config['repositories'][repository]['transient_db_path_override'])
        if data_store.get_active_commit() is None: return fail(no_active_commit_msg)
        to_delete = json.loads(body_data['files'])
        data_store.fs_delete(to_delete)
        return success()
    except Exception: 
        return fail()
def delete_files ( request : Request , context : ConnectionContext ) -> Responce : session_token = request . headers [ 'session_token' ] . encode ( 'utf8' ) repository = request . headers [ 'repository' ] current_user = have_authenticated_user ( request . remote_addr , repository , session_token ) if current_user is False : return fail ( user_auth_fail_msg ) repository_path = config [ 'repositories' ] [ repository ] [ 'path' ] body_data = request . get_json ( ) if not context . lock : return fail ( lock_fail_msg ) try : data_store = versioned_storage ( repository_path , path_override = config [ 'repositories' ] [ repository ] [ 'transient_db_path_override' ] ) if data_store . get_active_commit ( ) is None : return fail ( no_active_commit_msg ) to_delete = json . loads ( body_data [ 'files' ] ) data_store . fs_delete ( to_delete ) return success ( ) except Exception : return fail ( )
Delete one or more files from the server
Delete one or more files from the server
""" Delete one or more files from the server """ #=== #=== #=== #=== #------------- # pylint: disable=broad-except
request
Request
context
ConnectionContext