@@ -162,12 +162,7 @@ def after_rollback(self, session):
162
162
163
163
class _SignallingSession (Session ):
164
164
165
- def __init__ (self , db ):
166
- if isinstance (db .session_extensions , list ):
167
- db .session_extensions .append (_SignallingSessionExtension ())
168
- else :
169
- db .session_extensions = [db .session_extensions , _SignallingSessionExtension ()]
170
-
165
+ def __init__ (self , db ):
171
166
Session .__init__ (self , autocommit = False , autoflush = False ,
172
167
extension = db .session_extensions ,
173
168
bind = db .engine )
@@ -474,10 +469,15 @@ class User(db.Model):
474
469
pw_hash = db.Column(db.String(80))
475
470
"""
476
471
477
- def __init__ (self , app = None , use_native_unicode = True , session_extensions = [] ):
472
+ def __init__ (self , app = None , use_native_unicode = True , session_extensions = None ):
478
473
self .use_native_unicode = use_native_unicode
479
474
self .session_extensions = session_extensions
480
475
476
+ if self .session_extensions :
477
+ self .session_extensions = to_list (self .session_extensions ) + [_SignallingSessionExtension ()]
478
+ else :
479
+ self .session_extensions = [_SignallingSessionExtension ()]
480
+
481
481
self .session = _create_scoped_session (self )
482
482
483
483
self .Model = declarative_base (cls = Model , name = 'Model' )
0 commit comments