diff --git a/pokedex/db/multilang.py b/pokedex/db/multilang.py index 50521bf..c0c1965 100644 --- a/pokedex/db/multilang.py +++ b/pokedex/db/multilang.py @@ -210,7 +210,7 @@ def create_translation_table(_table_name, foreign_class, relation_name, class MultilangQuery(Query): def __iter__(self): - if '_default_language_id' not in self._params: + if '_default_language_id' not in self._params or self._params['_default_language_id'] == 'dummy': self._params = self._params.copy() self._params['_default_language_id'] = self.session.default_language_id return super(MultilangQuery, self).__iter__() diff --git a/pokedex/tests/test_schema.py b/pokedex/tests/test_schema.py index ebfd3e0..2288ac9 100644 --- a/pokedex/tests/test_schema.py +++ b/pokedex/tests/test_schema.py @@ -108,7 +108,7 @@ def test_i18n_table_creation(): sess.commit() ### Test 1: re-fetch foo and check its attributes - foo = sess.query(Foo).params(_default_language='en').one() + foo = sess.query(Foo).params(_default_language_id=lang_en.id).one() # Dictionary of language identifiers => names assert foo.name_map[lang_en] == 'english'