Use transactions on import; fix for date parser re-location

svn: r19667
This commit is contained in:
Doug Blank 2012-05-27 02:13:22 +00:00
parent 6f6c914649
commit 7b97bef883
2 changed files with 40 additions and 38 deletions

View File

@ -120,7 +120,7 @@ from gen.updatecallback import UpdateCallback
import gen.mime import gen.mime
import LdsUtils import LdsUtils
import Utils import Utils
from gen.datehandler._DateParser import DateParser import gen.datehandler._dateparser as DateParser
from gen.db.dbconst import EVENT_KEY from gen.db.dbconst import EVENT_KEY
from QuestionDialog import WarningDialog from QuestionDialog import WarningDialog
from gen.lib.const import IDENTICAL, DIFFERENT from gen.lib.const import IDENTICAL, DIFFERENT

View File

@ -43,6 +43,7 @@ from gen.db import (PERSON_KEY,
NOTE_KEY) NOTE_KEY)
import Utils import Utils
from webapp.libdjango import DjangoInterface from webapp.libdjango import DjangoInterface
from django.db import transaction
class Cursor(object): class Cursor(object):
def __init__(self, model, func): def __init__(self, model, func):
@ -177,6 +178,7 @@ class DbDjango(DbWriteBase, DbReadBase):
import for two step adding. import for two step adding.
""" """
# First we add the primary objects: # First we add the primary objects:
with transaction.commit_on_success():
for key in self.import_cache.keys(): for key in self.import_cache.keys():
obj = self.import_cache[key] obj = self.import_cache[key]
if isinstance(obj, gen.lib.Person): if isinstance(obj, gen.lib.Person):