diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-11-02 23:10:33 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-11-02 23:10:33 +0100 |
commit | f7a761e16440f4fdc87a4a1b7a5db04a3e42dbfc (patch) | |
tree | a26194aa14450642a714b282a8d5a531d93bfe65 | |
parent | added a command to delete inactive users (number of months given in parameter). (diff) | |
download | newspipe-f7a761e16440f4fdc87a4a1b7a5db04a3e42dbfc.tar.gz newspipe-f7a761e16440f4fdc87a4a1b7a5db04a3e42dbfc.tar.bz2 newspipe-f7a761e16440f4fdc87a4a1b7a5db04a3e42dbfc.zip |
fix definition of the filter variable
-rwxr-xr-x | newspipe/commands.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/newspipe/commands.py b/newspipe/commands.py index 03d5053e..219db8c4 100755 --- a/newspipe/commands.py +++ b/newspipe/commands.py @@ -66,12 +66,11 @@ def delete_user(user_id=None): @application.cli.command("delete_inactive_users") @click.option('--last-seen', default=6, help='Number of months since last seen.') def delete_inactive_users(last_seen): - "Delete inactive users." + "Delete inactive users (inactivity is given in parameter and specified in number of months)." + filter = {} filter["last_seen__lt"] = date.today() - relativedelta(months=last_seen) try: - user = UserController().read(**filter).all() - for us in user: - print(us.nickname) + user = UserController().delete(**filter) print("Inactive users deleted.") except Exception as e: print(e) |