Switch to unified view

a/Ming/ming/session.py b/Ming/ming/session.py
...
...
2
2
3
from base import Cursor, Object
3
from base import Cursor, Object
4
4
5
class Session(object):
5
class Session(object):
6
    _registry = {}
6
    _registry = {}
7
    _datastores = {}
7
8
8
    def __init__(self, bind=None):
9
    def __init__(self, bind=None):
9
        self.bind = bind
10
        self.bind = bind
10
11
11
    @classmethod
12
    @classmethod
12
    def by_name(cls, name):
13
    def by_name(cls, name):
13
        if name in cls._registry:
14
        if name in cls._registry:
14
            result = cls._registry[name]
15
            result = cls._registry[name]
15
        else:
16
        else:
16
            result = cls._registry[name] = cls()
17
            result = cls._registry[name] = cls(cls._datastores.get(name))
17
        return result
18
        return result
18
19
19
    def _impl(self, cls):
20
    def _impl(self, cls):
20
        try:
21
        try:
21
            return self.bind.db[cls.__mongometa__.name]
22
            return self.bind.db[cls.__mongometa__.name]