From 4660f58608d3dbf65b5566303938a603f2e19639 Mon Sep 17 00:00:00 2001 From: gwen Date: Wed, 6 Mar 2013 09:22:56 +0100 Subject: [PATCH] valid name accepts only str type --- tiramisu/config.py | 9 --------- tiramisu/option.py | 4 ++++ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/tiramisu/config.py b/tiramisu/config.py index 2a1f9cb..58e9067 100644 --- a/tiramisu/config.py +++ b/tiramisu/config.py @@ -326,16 +326,7 @@ class Config(object): subpath.insert(0, obj._cfgimpl_descr._name) obj = obj._cfgimpl_parent return ".".join(subpath) - # ______________________________________________________________________ -# def cfgimpl_previous_value(self, path): -# "stores the previous value" -# home, name = self._cfgimpl_get_home_by_path(path) -# # FIXME fucking name -# return home._cfgimpl_context._cfgimpl_values.previous_values[name] -# def get_previous_value(self, name): -# "for the time being, only the previous Option's value is accessible" -# return self._cfgimpl_context._cfgimpl_values.previous_values[name] # ______________________________________________________________________ def add_warning(self, warning): "Config implements its own warning pile. Could be useful" diff --git a/tiramisu/option.py b/tiramisu/option.py index 88ce51e..84b434d 100644 --- a/tiramisu/option.py +++ b/tiramisu/option.py @@ -41,6 +41,10 @@ for act1, act2 in requires_actions: name_regexp = re.compile(r'^\d+') def valid_name(name): + try: + name = str(name) + except: + raise ValueError("not a valid string name") if re.match(name_regexp, name) is None: return True else: