revert change in append of Multi object for sqlite3 storage

This commit is contained in:
Emmanuel Garette 2013-08-25 20:51:29 +02:00
parent dcb12dac02
commit dc2c173b44
1 changed files with 12 additions and 5 deletions

View File

@ -20,7 +20,7 @@
from time import time from time import time
from copy import copy from copy import copy
from tiramisu.error import ConfigError, SlaveError from tiramisu.error import ConfigError, SlaveError
from tiramisu.setting import owners, multitypes, expires_time, storage_type from tiramisu.setting import owners, multitypes, expires_time
from tiramisu.autolib import carry_out_calculation from tiramisu.autolib import carry_out_calculation
from tiramisu.i18n import _ from tiramisu.i18n import _
from tiramisu.option import SymLinkOption from tiramisu.option import SymLinkOption
@ -42,7 +42,7 @@ class Values(object):
""" """
self.context = context self.context = context
# the storage type is dictionary or sqlite3 # the storage type is dictionary or sqlite3
import_lib = 'tiramisu.storage.{0}.value'.format(storage_type) import_lib = 'tiramisu.storage.{0}.value'.format(storage.storage)
self._p_ = __import__(import_lib, globals(), locals(), ['Values'], self._p_ = __import__(import_lib, globals(), locals(), ['Values'],
-1).Values(storage) -1).Values(storage)
@ -408,9 +408,16 @@ class Multi(list):
dvalue = values._getcallback_value(slave, index=index) dvalue = values._getcallback_value(slave, index=index)
else: else:
dvalue = slave.impl_getdefault_multi() dvalue = slave.impl_getdefault_multi()
old_value = values.getitem(slave, path,
validate_properties=False)
if len(old_value) < self.__len__():
values.getitem(slave, path, values.getitem(slave, path,
validate_properties=False).append( validate_properties=False).append(
dvalue, force=True) dvalue, force=True)
else:
values.getitem(slave, path,
validate_properties=False)[
index] = dvalue
def sort(self, cmp=None, key=None, reverse=False): def sort(self, cmp=None, key=None, reverse=False):
if self.opt.impl_get_multitype() in [multitypes.slave, if self.opt.impl_get_multitype() in [multitypes.slave,