- session_args = dict(autoflush=True, autocommit=False, bind=engine)
- session_args.update(kwargs)
- sm = orm.sessionmaker(**session_args)
- session = orm.scoped_session(sm)
+ all_session_args = dict(autoflush=True, autocommit=False, bind=engine)
+ all_session_args.update(session_args)
+ sm = orm.sessionmaker(class_=MultilangSession, language_class=Language,
+ **all_session_args)
+ session = MultilangScopedSession(sm)
+
+ # Default to English
+ session.default_language = session.query(Language) \
+ .filter_by(identifier=u'en') \
+ .one()