diff options
Diffstat (limited to 'src/lib/Bcfg2/Server/Reports')
-rw-r--r-- | src/lib/Bcfg2/Server/Reports/reports/models.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/Bcfg2/Server/Reports/reports/models.py b/src/lib/Bcfg2/Server/Reports/reports/models.py index c7105fdd9..ac4c8eac4 100644 --- a/src/lib/Bcfg2/Server/Reports/reports/models.py +++ b/src/lib/Bcfg2/Server/Reports/reports/models.py @@ -9,11 +9,13 @@ except ImproperlyConfigured: print("Reports: unable to import django models: %s" % e) sys.exit(1) -from django.db import connection, transaction +from django.db import connection from django.db.models import Q from datetime import datetime, timedelta from time import strptime +from Bcfg2.Reporting.Compat import transaction + KIND_CHOICES = ( #These are the kinds of config elements ('Package', 'Package'), @@ -294,7 +296,7 @@ class Reason(models.Model): return rv @staticmethod - @transaction.commit_on_success + @transaction.atomic def prune_orphans(): '''Prune oprhaned rows... no good way to use the ORM''' cursor = connection.cursor() @@ -311,7 +313,7 @@ class Entries(models.Model): return self.name @staticmethod - @transaction.commit_on_success + @transaction.atomic def prune_orphans(): '''Prune oprhaned rows... no good way to use the ORM''' cursor = connection.cursor() @@ -340,7 +342,7 @@ class Performance(models.Model): return self.metric @staticmethod - @transaction.commit_on_success + @transaction.atomic def prune_orphans(): '''Prune oprhaned rows... no good way to use the ORM''' cursor = connection.cursor() |