~cedric/newspipe

f7a761e16440f4fdc87a4a1b7a5db04a3e42dbfc — C├ędric Bonhomme 26 days ago ca25a7e
fix definition of the filter variable
1 files changed, 3 insertions(+), 4 deletions(-)

M newspipe/commands.py
M newspipe/commands.py => newspipe/commands.py +3 -4
@@ 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)