Ejemplo n.º 1
0
 def save_import(self):
   """Commit all changes in the session and update memcache."""
   try:
     modified_objects = get_modified_objects(db.session)
     log_event(db.session, None)
     update_memcache_before_commit(
         self, modified_objects, CACHE_EXPIRY_IMPORT)
     db.session.commit()
     update_memcache_after_commit(self)
     update_index(db.session, modified_objects)
   except exc.SQLAlchemyError as err:
     db.session.rollback()
     logger.exception("Import failed with: %s", err.message)
     self.add_errors(errors.UNKNOWN_ERROR, line=self.offset + 2)
Ejemplo n.º 2
0
 def save_import(self):
   """Commit all changes in the session and update memcache."""
   try:
     modified_objects = get_modified_objects(db.session)
     import_event = log_event(db.session, None)
     update_memcache_before_commit(
         self, modified_objects, CACHE_EXPIRY_IMPORT)
     db.session.commit()
     update_memcache_after_commit(self)
     update_snapshot_index(db.session, modified_objects)
     return import_event
   except exc.SQLAlchemyError as err:
     db.session.rollback()
     logger.exception("Import failed with: %s", err.message)
     self.add_errors(errors.UNKNOWN_ERROR, line=self.offset + 2)