def __init__(self, db='nonedb.json'):
# Storage and serialization
serializer = SerializationMiddleware(tinydb.storages.JSONStorage)
serializer.register_serializer(DateTimeSerializer(), 'TinyDateTime')
# A reference to the actual database object.
self._conn = tinydb.TinyDB(db, storage=serializer)
# Activat SmartCache
self._conn.table_class = SmartCacheTable
# A shortcut to ``tinydb.TinyDB.table`` method.
# See http://tinydb.readthedocs.org/en/latest/usage.html#tables
# for reference.
self.table = self._conn.table
# A shortcut to ``tinydb.where`` object.
# See http://tinydb.readthedocs.org/en/latest/usage.html#queries
# for reference.
self.where = tinydb.where
评论列表
文章目录