Parent: [b2d81e] (diff)

Child: [a9f890] (diff)

Download this file

__init__.py    21 lines (17 with data), 602 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
from formencode.variabledecode import variable_decode
import pymongo
from session import Session
from base import Document
# Re-export direction keys
ASCENDING = pymongo.ASCENDING
DESCENDING = pymongo.DESCENDING
def configure(**kwargs):
from datastore import DataStore
config = variable_decode(kwargs)
datastores = dict(
(name, DataStore(**value))
for name, value in config['ming'].iteritems())
Session._datastores = datastores
# bind any existing sessions
for name, session in Session._registry.iteritems():
session.bind = datastores.get(name, None)