can change storage with set_storage, storage's name is store in storage object and storage is create with get_storage
This commit is contained in:
@ -24,6 +24,8 @@ from tiramisu.i18n import _
|
||||
|
||||
class Storage(object):
|
||||
__slots__ = tuple()
|
||||
storage = 'dictionary'
|
||||
|
||||
def __init__(self, config_id, is_persistent):
|
||||
if is_persistent:
|
||||
raise ValueError(_('a dictionary cannot be persistent'))
|
||||
|
@ -25,6 +25,7 @@ import sqlite3
|
||||
|
||||
class Storage(object):
|
||||
__slots__ = ('_conn', '_cursor', 'is_persistent', 'db_file')
|
||||
storage = 'sqlite3'
|
||||
|
||||
def __init__(self, config_id, is_persistent):
|
||||
self.is_persistent = is_persistent
|
||||
|
@ -70,12 +70,12 @@ class Values(Cache):
|
||||
path = self._sqlite_encode_path(path)
|
||||
self.storage.execute("DELETE FROM value WHERE path = ?", (path,))
|
||||
|
||||
def get_modified_values(self, context):
|
||||
def get_modified_values(self):
|
||||
"""return all values in a dictionary
|
||||
example: {option1: (owner, 'value1'), option2: (owner, 'value2')}
|
||||
"""
|
||||
ret = {}
|
||||
for path, value, owner in self.storage.select("SELECT value",
|
||||
for path, value, owner in self.storage.select("SELECT * FROM value",
|
||||
only_one=False):
|
||||
path = self._sqlite_decode_path(path)
|
||||
owner = getattr(owners, owner)
|
||||
|
Reference in New Issue
Block a user