equal
deleted
inserted
replaced
399 if raise_on_error: |
399 if raise_on_error: |
400 raise |
400 raise |
401 self.import_log.record_error(str(ex)) |
401 self.import_log.record_error(str(ex)) |
402 return True |
402 return True |
403 error = False |
403 error = False |
|
404 # Check whether self._cw is a session or a connection |
|
405 if getattr(self._cw, 'commit', None) is not None: |
|
406 commit = self._cw.commit |
|
407 set_cnxset = self._cw.set_cnxset |
|
408 rollback = self._cw.rollback |
|
409 else: |
|
410 commit = self._cw.cnx.commit |
|
411 set_cnxset = lambda: None |
|
412 rollback = self._cw.cnx.rollback |
404 for args in parsed: |
413 for args in parsed: |
405 try: |
414 try: |
406 self.process_item(*args) |
415 self.process_item(*args) |
407 if partialcommit: |
416 if partialcommit: |
408 # commit+set_cnxset instead of commit(free_cnxset=False) to let |
417 # commit+set_cnxset instead of commit(free_cnxset=False) to let |
409 # other a chance to get our connections set |
418 # other a chance to get our connections set |
410 self._cw.commit() |
419 commit() |
411 self._cw.set_cnxset() |
420 set_cnxset() |
412 except ValidationError, exc: |
421 except ValidationError, exc: |
413 if raise_on_error: |
422 if raise_on_error: |
414 raise |
423 raise |
415 if partialcommit: |
424 if partialcommit: |
416 self.source.error('Skipping %s because of validation error %s' % (args, exc)) |
425 self.source.error('Skipping %s because of validation error %s' % (args, exc)) |
417 self._cw.rollback() |
426 rollback() |
418 self._cw.set_cnxset() |
427 set_cnxset() |
419 error = True |
428 error = True |
420 else: |
429 else: |
421 raise |
430 raise |
422 return error |
431 return error |
423 |
432 |