valid name accepts only str type

This commit is contained in:
gwen 2013-03-06 09:22:56 +01:00
parent df3753c36b
commit 4660f58608
2 changed files with 4 additions and 9 deletions

View file

@ -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"

View file

@ -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: