mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-15 02:20:40 +00:00
Make the app arg in @background functions a bit less magical
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
from .. import logger
|
||||
from ..decorators import background
|
||||
from ..models import User
|
||||
import os
|
||||
@ -6,13 +5,12 @@ import shutil
|
||||
|
||||
|
||||
@background
|
||||
def delete_user(app, user_id):
|
||||
logger.warning('aufgerufen')
|
||||
def delete_user(user_id, *args, **kwargs):
|
||||
app = kwargs['app']
|
||||
with app.app_context():
|
||||
user = User.query.get(user_id)
|
||||
if user is None:
|
||||
raise Exception('User {} not found!'.format(user_id))
|
||||
logger.warning('deleting user')
|
||||
path = os.path.join(app.config['NOPAQUE_STORAGE'], str(user.id))
|
||||
shutil.rmtree(path, ignore_errors=True)
|
||||
user.delete()
|
||||
|
Reference in New Issue
Block a user