def set_current_version( cls, fixture_class = None, fixture_version = 0 ): """Set the current version of the fixtures in the database for a certain fixture class. :param fixture_class: the fixture class for which to get the version :param fixture_version: the version number to which to set the fixture version """ from sqlalchemy.orm.session import Session obj = Session().query( cls ).filter_by( fixture_class = fixture_class ).first() if not obj: obj = FixtureVersion( fixture_class = fixture_class ) obj.fixture_version = fixture_version Session.object_session( obj ).flush()
def set_current_version(cls, fixture_class=None, fixture_version=0): """Set the current version of the fixtures in the database for a certain fixture class. :param fixture_class: the fixture class for which to get the version :param fixture_version: the version number to which to set the fixture version """ from sqlalchemy.orm.session import Session obj = Session().query(cls).filter_by( fixture_class=fixture_class).first() if not obj: obj = FixtureVersion(fixture_class=fixture_class) obj.fixture_version = fixture_version Session.object_session(obj).flush()