- @property
- def default_language(self):
- # Need to import tables here to avoid a circular dependency
- from pokedex.db import tables
- query = self.query(tables.Language)
- query = query.filter_by(id=self._default_language_id)
- return query.one()
-
- @default_language.setter
- def default_language(self, new):
- self._default_language_id = new.id
-
- @default_language.deleter
- def default_language(self):
- try:
- del self._default_language_id
- except AttributeError:
- pass
+ Needs to be used with `MultilangScopedSession`, below.
+ """
+ default_language_id = None
+
+ def __init__(self, *args, **kwargs):
+ if 'default_language_id' in kwargs:
+ self.default_language_id = kwargs.pop('default_language_id')
+
+ super(MultilangSession, self).__init__(*args, **kwargs)