projects
/
zzz-pokedex.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make the schema tests pass
[zzz-pokedex.git]
/
pokedex
/
db
/
__init__.py
diff --git
a/pokedex/db/__init__.py
b/pokedex/db/__init__.py
index
ae06c1b
..
464629d
100644
(file)
--- a/
pokedex/db/__init__.py
+++ b/
pokedex/db/__init__.py
@@
-7,6
+7,8
@@
from ..defaults import get_default_db_uri
from .tables import Language, metadata
from .multilang import MultilangSession, MultilangScopedSession
from .tables import Language, metadata
from .multilang import MultilangSession, MultilangScopedSession
+ENGLISH_ID = 9
+
def connect(uri=None, session_args={}, engine_args={}, engine_prefix=''):
"""Connects to the requested URI. Returns a session object.
def connect(uri=None, session_args={}, engine_args={}, engine_prefix=''):
"""Connects to the requested URI. Returns a session object.
@@
-44,15
+46,10
@@
def connect(uri=None, session_args={}, engine_args={}, engine_prefix=''):
all_session_args = dict(autoflush=True, autocommit=False, bind=engine)
all_session_args.update(session_args)
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)
+ sm = orm.sessionmaker(class_=MultilangSession,
+
default_language_id=ENGLISH_ID,
**all_session_args)
session = MultilangScopedSession(sm)
session = MultilangScopedSession(sm)
- # Default to English. Warning, magic constant, blah blah. Trying to fetch
- # English here would kinda break on new databases. TODO still not an ideal
- # solution, I guess.
- session._default_language_id = 9
-
return session
def identifier_from_name(name):
return session
def identifier_from_name(name):