From: Petr Viktorin Date: Sun, 3 Apr 2011 19:05:56 +0000 (+0300) Subject: Make session.default_language set/get work X-Git-Tag: veekun-promotions/2011041101~8^2~2 X-Git-Url: http://git.veekun.com/zzz-pokedex.git/commitdiff_plain/06545f5b48416ba0507d26499db2d57d6d69e13b Make session.default_language set/get work --- diff --git a/pokedex/db/multilang.py b/pokedex/db/multilang.py index 4adb68d..b5f87e4 100644 --- a/pokedex/db/multilang.py +++ b/pokedex/db/multilang.py @@ -159,12 +159,15 @@ class MultilangSession(Session): @property def default_language(self): - # XXX need to get the right mapped class for this to work - raise NotImplementedError + # 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 + self._default_language_id = new.id @default_language.deleter def default_language(self):