active callback's slave verification
authorEmmanuel Garette <egarette@cadoles.com>
Tue, 28 Jan 2014 08:14:56 +0000 (09:14 +0100)
committerEmmanuel Garette <egarette@cadoles.com>
Tue, 28 Jan 2014 08:14:56 +0000 (09:14 +0100)
test/test_option_calculation.py
tiramisu/option.py

index 8c73a5a..2cacf5e 100644 (file)
@@ -481,7 +481,6 @@ def test_callback_master_and_slaves_slave_list():
     assert cfg.val1.val2 == ['val', 'val']
     cfg.val1.val1 = ['val1']
     #wrong len
-    print cfg.val1.val2
     raises(SlaveError, 'cfg.val1.val2')
 
 
index 8556e92..7aa6ad5 100644 (file)
@@ -1349,15 +1349,14 @@ class OptionDescription(BaseOption, StorageOptionDescription):
                     raise ValueError(_('master group with wrong'
                                        ' master name for {0}'
                                        ).format(self.impl_getname()))
-                #FIXME debut reecriture
-                ##master_callback, master_callback_params = master.impl_get_callback()
-                #if master._callback is not None and master._callback[1] is not None:
-                #    for key, callbacks in master._callback[1].items():
-                #        for callbk in callbacks:
-                #            if isinstance(callbk, tuple):
-                #                if callbk[0] in slaves:
-                #                    raise ValueError(_("callback of master's option shall "
-                #                                       "not refered a slave's ones"))
+                master_callback, master_callback_params = master.impl_get_callback()
+                if master_callback is not None and master_callback_params is not None:
+                    for key, callbacks in master_callback_params.items():
+                        for callbk in callbacks:
+                            if isinstance(callbk, tuple):
+                                if callbk[0] in slaves:
+                                    raise ValueError(_("callback of master's option shall "
+                                                       "not refered a slave's ones"))
                 master._master_slaves = tuple(slaves)
                 for child in self.impl_getchildren():
                     if child != master: