From 573f034df264b141c53b33d346a56a0b21cc803f Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 16 Nov 2014 11:23:02 +0000 Subject: [PATCH] wrap get_frame into transaction to avoid postgres error --- pandora/item/management/commands/get_frame.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandora/item/management/commands/get_frame.py b/pandora/item/management/commands/get_frame.py index 5c515f41..293f4754 100644 --- a/pandora/item/management/commands/get_frame.py +++ b/pandora/item/management/commands/get_frame.py @@ -2,6 +2,7 @@ # vi:si:et:sw=4:sts=4:ts=4 from django.core.management.base import BaseCommand from django.conf import settings +from django.db import transaction settings.RELOAD_CONFIG = False import app.monkey_patch @@ -14,7 +15,8 @@ class Command(BaseCommand): def handle(self, id, height, position, **options): position = float(position) height = int(height) - i = models.Item.objects.get(public_id=id) - path = i.frame(position, height) + with transaction.commit_on_success(): + i = models.Item.objects.get(public_id=id) + path = i.frame(position, height) if path: print path