示例#1
0
    def save(self, instance, fixtures, session):
        """Save instance."""
        fixtures.get_hook("before_save")(instance)

        if session and is_sqlalchemy_model(instance):
            session.add(instance)
            session.commit()

        else:
            getattr(instance, "save", lambda: None)()

        fixtures.get_hook("after_save")(instance)
示例#2
0
    def save(self, instance, fixtures, session):
        """Save instance."""
        fixtures.get_hook("before_save")(instance)

        if session and is_sqlalchemy_model(instance):
            session.add(instance)
            session.commit()

        else:
            getattr(instance, "save", lambda: None)()

        fixtures.get_hook("after_save")(instance)
示例#3
0
 def delete(self, instance, session):
     """Delete instance."""
     if session and is_sqlalchemy_model(instance):
         session.delete(instance)
         session.commit()
示例#4
0
 def delete(self, instance, session):
     """Delete instance."""
     if session and is_sqlalchemy_model(instance):
         session.delete(instance)
         session.commit()