diff options
-rwxr-xr-x | newspipe/commands.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/newspipe/commands.py b/newspipe/commands.py index 219db8c4..ca586039 100755 --- a/newspipe/commands.py +++ b/newspipe/commands.py @@ -70,7 +70,14 @@ def delete_inactive_users(last_seen): filter = {} filter["last_seen__lt"] = date.today() - relativedelta(months=last_seen) try: - user = UserController().delete(**filter) + users = UserController().read(**filter) + for user in users: + db.session.delete(user) + try: + print("Deleting user {}...".format(user.nickname)) + db.session.commit() + except: + db.session.rollback() print("Inactive users deleted.") except Exception as e: print(e) |