Coverage for appr/models/__init__.py: 75%

# Coverage for appr/models/__init__.py : 75%

## 24 statements 18 run 6 missing 0 excluded

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import os from appr.utils import symbol_by_name DEFAULT_MEDIA_TYPE = 'kpm' DEFAULT_STORAGE_MODULE = "appr.models.kv.filesystem" DEFAULT_DB_CLASS = "%s.db:ApprDB" % DEFAULT_STORAGE_MODULE DEFAULT_BLOB_CLASS = "%s.blob:Blob" % DEFAULT_STORAGE_MODULE def get_db_class(name=None): if not name: name = os.getenv("APPR_DB_CLASS", DEFAULT_DB_CLASS) if name == "filesystem": from appr.models.kv.filesystem.db import FilesystemDB db = FilesystemDB elif name == "redis": from appr.models.kv.redis.db import RedisDB db = RedisDB elif name == "etcd": from appr.models.kv.etcd.db import EtcdDB db = EtcdDB else: db = symbol_by_name(name) return db ApprDB = get_db_class() Channel = ApprDB.Channel Package = ApprDB.Package Blob = ApprDB.Blob