add sqlite plugin

This commit is contained in:
2013-08-19 11:01:21 +02:00
parent f6f709f83d
commit df7d6759cd
13 changed files with 429 additions and 111 deletions

View File

@ -24,7 +24,8 @@ from time import time
from copy import copy
from tiramisu.error import RequirementError, PropertiesOptionError
from tiramisu.i18n import _
from tiramisu.plugins.dictionary.setting import PluginSettings
#from tiramisu.plugins.dictionary.setting import PluginSettings
from tiramisu.plugins.sqlite3.setting import PluginSettings
default_encoding = 'utf-8'
@ -182,11 +183,11 @@ class Settings(PluginSettings):
"``Config()``'s configuration options"
__slots__ = ('context', '_owner')
def __init__(self, context):
def __init__(self, context, config_id):
# generic owner
self._owner = owners.user
self.context = context
super(Settings, self).__init__()
super(Settings, self).__init__(config_id)
#____________________________________________________________
# properties methods
@ -217,9 +218,9 @@ class Settings(PluginSettings):
props = self._p_getproperties(opt, default_properties)
else:
ntime = None
if self._p_hascache('properties', opt):
if self._p_hascache('property', opt):
ntime = time()
is_cached, props = self._p_getcache('properties', opt, ntime)
is_cached, props = self._p_getcache('property', opt, ntime)
if is_cached:
return props
if is_apply_req:
@ -228,7 +229,7 @@ class Settings(PluginSettings):
if 'expire' in self:
if ntime is None:
ntime = time()
self._p_setcache('properties', opt, props, ntime + expires_time)
self._p_setcache('property', opt, props, ntime + expires_time)
return props
def append(self, propname):
@ -328,9 +329,9 @@ class Settings(PluginSettings):
def reset_cache(self, only_expired):
if only_expired:
self._p_reset_expired_cache('properties', time())
self._p_reset_expired_cache('property', time())
else:
self._p_reset_all_cache('properties')
self._p_reset_all_cache('property')
def apply_requires(self, opt):
"carries out the jit (just in time requirements between options"
@ -373,3 +374,6 @@ class Settings(PluginSettings):
# no requirement has been triggered, then just reverse the action
if not matches:
setting.remove(action)
def _get_opt_path(self, opt):
return self.context.cfgimpl_get_description().impl_get_path_by_opt(opt)