From 13fcb20796d07ba5eb8d8158e7bb39d5ee395f41 Mon Sep 17 00:00:00 2001 From: j Date: Sun, 29 Jul 2018 18:56:01 +0100 Subject: [PATCH] update get_frame command for new django version, fixes #3155 --- pandora/item/management/commands/get_frame.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pandora/item/management/commands/get_frame.py b/pandora/item/management/commands/get_frame.py index 94b601e19..69e78e4e9 100644 --- a/pandora/item/management/commands/get_frame.py +++ b/pandora/item/management/commands/get_frame.py @@ -11,13 +11,18 @@ from ... import models class Command(BaseCommand): help = 'extract frame and print path' - args = ' ' - def handle(self, id, height, position, **options): + def add_arguments(self, parser): + parser.add_argument('args', metavar='args', type=str, nargs='*', help=' ') + + def handle(self, id, height, position, **kwargs): position = float(position) height = int(height) with transaction.atomic(): - i = models.Item.objects.get(public_id=id) - path = i.frame(position, height) + try: + i = models.Item.objects.get(public_id=id) + path = i.frame(position, height) + except models.Item.DoesNotExist: + path = None if path: print(path)