def save_inventory(station, downloaded_bytes_data):
"""Saves the inventory. Raises SqlAlchemyError if station's session is None,
or (most likely IntegrityError) on failure
"""
station.inventory_xml = dumps_inv(downloaded_bytes_data)
try:
object_session(station).commit()
except UnmappedInstanceError:
raise
except SQLAlchemyError:
object_session(station).rollback()
raise
评论列表
文章目录