def __init__(self, db=None, bind=None, **options): if db is None: db = self._db #: The application that this session belongs to. self.app = db.get_app() self._model_changes = {} options.update(self._options) options.setdefault('autocommit', False) options.setdefault('autoflush', False) options.setdefault('binds', db.get_binds(self.app)) #: A flag that controls whether this session should keep track of #: model modifications. The default value for this attribute #: is set from the ``SQLALCHEMY_TRACK_MODIFICATIONS`` config #: key. self.emit_modification_signals = \ self.app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] bind = options.pop('bind', None) or db.engine SessionBase.__init__(self, bind=bind, **options)
def __init__(self, db, autocommit=False, autoflush=True, **options): self.app = db.get_app() self._model_changes = {} self.emit_modification_signals = self.app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] bind = options.pop('bind', None) if bind is None: bind = db.engine binds = options.pop('binds', None) if binds is None: binds = db.get_binds(self.app) SessionBase.__init__(self, autocommit=autocommit, autoflush=autoflush, bind=bind, binds=binds, **options)
def __init__(self, db, autocommit=False, autoflush=True, **options): self.app = db.get_app() self._model_changes = {} self.emit_modification_signals = \ self.app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] bind = options.pop('bind', None) if bind is None: bind = db.engine binds = options.pop('binds', None) if binds is None: binds = db.get_binds(self.app) SessionBase.__init__(self, autocommit=autocommit, autoflush=autoflush, bind=bind, binds=binds, **options)