From c272173d8f5afc96e3230dae796bed2f8d1a0e89 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 26 Sep 2009 11:09:35 -0500 Subject: reporead: do all DB updates in one transaction Signed-off-by: Dan McGee --- scripts/reporead.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/reporead.py b/scripts/reporead.py index 361d0db..daed1f0 100755 --- a/scripts/reporead.py +++ b/scripts/reporead.py @@ -39,11 +39,14 @@ from datetime import datetime from django.core.management import setup_environ # mung the sys path to get to django root dir, no matter # where we are called from +# TODO this is so fricking ugly archweb_app_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) os.chdir(archweb_app_path) sys.path[0] = archweb_app_path import settings setup_environ(settings) +# the transaction import must be below where we set up our db stuff... +from django.db import transaction from cStringIO import StringIO from logging import WARNING,INFO,DEBUG from main.models import Arch, Package, Repo @@ -335,6 +338,7 @@ def parse_repo(repopath): return pkgs +@transaction.commit_on_success def main(argv=None): """ Parses repo.db.tar.gz file and returns exit status. -- cgit v1.2.3-24-g4f1b