mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
"Fix" MultilangQuery.
SQLAlchemy 1.0 sets bindpararms to their default values when loading lazy-loaded columns. This is in contrast to the 0.9 behaviour of ignoring our incongruous bindparam alltogether. So MultilangQuery is still broken, but now it breaks in the same way as before. While we're here, set the correct param in one of the multilang tests. Not that it matters.
This commit is contained in:
parent
2cfc78edac
commit
02b1968bc5
2 changed files with 2 additions and 2 deletions
|
@ -210,7 +210,7 @@ def create_translation_table(_table_name, foreign_class, relation_name,
|
||||||
|
|
||||||
class MultilangQuery(Query):
|
class MultilangQuery(Query):
|
||||||
def __iter__(self):
|
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 = self._params.copy()
|
||||||
self._params['_default_language_id'] = self.session.default_language_id
|
self._params['_default_language_id'] = self.session.default_language_id
|
||||||
return super(MultilangQuery, self).__iter__()
|
return super(MultilangQuery, self).__iter__()
|
||||||
|
|
|
@ -108,7 +108,7 @@ def test_i18n_table_creation():
|
||||||
sess.commit()
|
sess.commit()
|
||||||
|
|
||||||
### Test 1: re-fetch foo and check its attributes
|
### 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
|
# Dictionary of language identifiers => names
|
||||||
assert foo.name_map[lang_en] == 'english'
|
assert foo.name_map[lang_en] == 'english'
|
||||||
|
|
Loading…
Reference in a new issue