pgcontents/query.py
def delete_directory(db, user_id, api_path):
    """
    Delete a directory.
    """
    db_dirname = from_api_dirname(api_path)
    try:
        result = db.execute(
            directories.delete().where(
                and_(
                    directories.c.user_id == user_id,
                    directories.c.name == db_dirname,
                )
            )
        )
    except IntegrityError as error:
        if is_foreign_key_violation(error):
            raise DirectoryNotEmpty(api_path)
        else:
            raise

    rowcount = result.rowcount
    if not rowcount:
        raise NoSuchDirectory(api_path)

    return rowcount
def delete_directory(db, user_id, api_path):
    db_dirname = from_api_dirname(api_path)
    try:
        result = db.execute(
            directories.delete().where(
                and_(
                    directories.c.user_id == user_id,
                    directories.c.name == db_dirname,
                )
            )
        )
    except IntegrityError as error:
        if is_foreign_key_violation(error):
            raise DirectoryNotEmpty(api_path)
        else:
            raise

    rowcount = result.rowcount
    if not rowcount:
        raise NoSuchDirectory(api_path)

    return rowcount
def delete_directory ( db , user_id , api_path ) : db_dirname = from_api_dirname ( api_path ) try : result = db . execute ( directories . delete ( ) . where ( and_ ( directories . c . user_id == user_id , directories . c . name == db_dirname , ) ) ) except IntegrityError as error : if is_foreign_key_violation ( error ) : raise DirectoryNotEmpty ( api_path ) else : raise rowcount = result . rowcount if not rowcount : raise NoSuchDirectory ( api_path ) return rowcount
Delete a directory.
Delete a directory .