From c6fe73939a52b129bf8dd0e1126ffe544ef66c7a Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Mon, 23 Jan 2012 19:20:19 -0400 Subject: [PATCH] Ignore database errors during the syncdb phase --- apps/history/api.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/history/api.py b/apps/history/api.py index 04e212d3a2..6bb8e42322 100644 --- a/apps/history/api.py +++ b/apps/history/api.py @@ -7,6 +7,7 @@ from django.db import transaction from django.core import serializers from django.shortcuts import get_object_or_404 from django.db import models +from django.db.utils import DatabaseError from .models import HistoryType, History from .runtime_data import history_types_dict @@ -17,9 +18,13 @@ def register_history_type(history_type_dict): namespace = history_type_dict['namespace'] name = history_type_dict['name'] - history_type_obj, created = HistoryType.objects.get_or_create( - namespace=namespace, name=name) - history_type_obj.save() + try: + history_type_obj, created = HistoryType.objects.get_or_create( + namespace=namespace, name=name) + history_type_obj.save() + except DatabaseError: + # Special case for syncdb + pass # Runtime history_types_dict.setdefault(namespace, {})