From 38adf649970a23973f8aa88a046aac6997f8a388 Mon Sep 17 00:00:00 2001 From: Steven Loria Date: Sat, 19 Apr 2014 14:39:47 -0400 Subject: [PATCH] Remove unnecessary custom signalling session --- .../{{cookiecutter.app_name}}/extensions.py | 35 ++----------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/extensions.py b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/extensions.py index 0e13839..a9dc6b7 100644 --- a/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/extensions.py +++ b/{{cookiecutter.app_name}}/{{cookiecutter.app_name}}/extensions.py @@ -9,39 +9,8 @@ bcrypt = Bcrypt() from flask.ext.login import LoginManager login_manager = LoginManager() -from flask.ext.sqlalchemy import SQLAlchemy, SignallingSession, SessionBase -class _SignallingSession(SignallingSession): - """A subclass of `SignallingSession` that allows for `binds` to be specified - in the `options` keyword arguments. - - """ - 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) - - -class _SQLAlchemy(SQLAlchemy): - """A subclass of `SQLAlchemy` that uses `_SignallingSession`.""" - def create_session(self, options): - return _SignallingSession(self, **options) -db = _SQLAlchemy() +from flask.ext.sqlalchemy import SQLAlchemy +db = SQLAlchemy() from flask.ext.migrate import Migrate migrate = Migrate()