Exemplo n.º 1
0
def delete_files(user_id, model_nk=None, modifier_id=None):
    query = Filex.all()
    query.filter("creator_id =", user_id)
    if model_nk != None:
        query.filter("model_name =", model_nk[0])
        query.filter("model_key =", str(model_nk[1]))
    files = query.fetch()
    for filex in files:
        _delete_file(filex.root_path, filex.save_path)
    result = query.delete(modifier_id)
    return result
Exemplo n.º 2
0
def fetch_files(user_id, model_nk=None):
    query = Filex.all()
    query.what("uid", alias="file_id")
    query.what("creator_id", alias="creator_id")
    query.what("file_name", alias="file_name")
    query.filter("creator_id =", user_id)
    if model_nk is not None:
        query.filter("model_name =", model_nk[0])
        query.filter("model_key =", str(model_nk[1]))
        
    return query.fetch()