From dc2c173b44d68a0ebf957088afbf3211d6da4585 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 25 Aug 2013 20:51:29 +0200 Subject: [PATCH] revert change in append of Multi object for sqlite3 storage --- tiramisu/value.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tiramisu/value.py b/tiramisu/value.py index fb62698..b5092d8 100644 --- a/tiramisu/value.py +++ b/tiramisu/value.py @@ -20,7 +20,7 @@ from time import time from copy import copy 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.i18n import _ from tiramisu.option import SymLinkOption @@ -42,7 +42,7 @@ class Values(object): """ self.context = context # 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'], -1).Values(storage) @@ -408,9 +408,16 @@ class Multi(list): dvalue = values._getcallback_value(slave, index=index) else: dvalue = slave.impl_getdefault_multi() - values.getitem(slave, path, - validate_properties=False).append( - dvalue, force=True) + old_value = values.getitem(slave, path, + validate_properties=False) + if len(old_value) < self.__len__(): + values.getitem(slave, path, + validate_properties=False).append( + dvalue, force=True) + else: + values.getitem(slave, path, + validate_properties=False)[ + index] = dvalue def sort(self, cmp=None, key=None, reverse=False): if self.opt.impl_get_multitype() in [multitypes.slave,