only catch PropertiesOptionError
authorEmmanuel Garette <egarette@cadoles.com>
Tue, 16 Apr 2013 10:04:20 +0000 (12:04 +0200)
committerEmmanuel Garette <egarette@cadoles.com>
Tue, 16 Apr 2013 10:04:20 +0000 (12:04 +0200)
tiramisu/config.py
tiramisu/value.py

index 76eafa9..b622113 100644 (file)
@@ -203,7 +203,7 @@ class SubConfig(object):
                     yield child._name, getattr(self, child._name)
                 except GeneratorExit:
                     raise StopIteration
-                except:
+                except PropertiesOptionError:
                     pass  # option with properties
 
     def iter_all(self):
@@ -214,7 +214,7 @@ class SubConfig(object):
                 yield child._name, getattr(self, child._name)
             except GeneratorExit:
                 raise StopIteration
-            except:
+            except PropertiesOptionError:
                 pass  # option with properties
 
     def iter_groups(self, group_type=None):
@@ -240,7 +240,7 @@ class SubConfig(object):
                         yield child._name, getattr(self, child._name)
                 except GeneratorExit:
                     raise StopIteration
-                except:
+                except PropertiesOptionError:
                     pass
     # ______________________________________________________________________
 
@@ -252,7 +252,7 @@ class SubConfig(object):
         for name, value in self:
             try:
                 lines.append("%s = %s" % (name, value))
-            except:
+            except PropertiesOptionError:
                 pass
         return '\n'.join(lines)
 
@@ -425,8 +425,7 @@ class Config(SubConfig):
                     getattr(homeconfig, name)
                 except MandatoryError:
                     pass
-                except Exception, e:
-                    #FIXME hu? should have Exception ?
+                except PropertiesOptionError, e:
                     raise e  # HiddenOptionError or DisabledOptionError
                 child = getattr(homeconfig._cfgimpl_descr, name)
                 homeconfig.setoption(name, child, value)
@@ -464,7 +463,7 @@ class Config(SubConfig):
                 value = getattr(self, path)
                 if value == byvalue:
                     return True
-            except:  # a property restricts the access of the value
+            except PropertiesOptionError:  # a property restricts the access of the value
                 pass
             return False
 
@@ -504,7 +503,7 @@ class Config(SubConfig):
             #remove option with propertyerror, ...
             try:
                 value = getattr(self, path)
-            except:  # a property restricts the access of the value
+            except PropertiesOptionError:  # a property restricts the access of the value
                 continue
             if not _filter_by_type():
                 continue
index 61217a5..0fcd1d0 100644 (file)
@@ -108,7 +108,7 @@ class Values(object):
         return Multi(_result, self.context, opt)  # , multitype)
 
     def _getcallback_value(self, opt):
-        callback, callback_params = opt.callback
+        callback, callback_params = opt._callback
         if callback_params is None:
             callback_params = {}
         return carry_out_calculation(opt._name, config=self.context,