Esempio n. 1
0
File: auth.py Progetto: Secaly/mushi
def delete_user(auth_token, email):
    if email == 'me':
        user = auth_token.owner
    else:
        try:
            user = db_session.query(User).filter(User.email == email).one()
        except NoResultFound:
            abort(404)

    db_session.delete(user)
    db_session.commit()

    return '', 204
Esempio n. 2
0
def delete_attachment(auth_token, uid):
    try:
        attachment = db_session.query(Attachment).filter(Attachment.uid == uid).one()
    except NoResultFound:
        abort(404)

    # Delete the attachment file and its thumbails from the filesystem.
    for filename in glob.glob(attachment.filename + '*'):
        os.remove(filename)

    db_session.delete(attachment)
    db_session.commit()

    return '', 204