valid name accepts only str type
This commit is contained in:
parent
df3753c36b
commit
4660f58608
2 changed files with 4 additions and 9 deletions
|
@ -326,16 +326,7 @@ class Config(object):
|
||||||
subpath.insert(0, obj._cfgimpl_descr._name)
|
subpath.insert(0, obj._cfgimpl_descr._name)
|
||||||
obj = obj._cfgimpl_parent
|
obj = obj._cfgimpl_parent
|
||||||
return ".".join(subpath)
|
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):
|
def add_warning(self, warning):
|
||||||
"Config implements its own warning pile. Could be useful"
|
"Config implements its own warning pile. Could be useful"
|
||||||
|
|
|
@ -41,6 +41,10 @@ for act1, act2 in requires_actions:
|
||||||
name_regexp = re.compile(r'^\d+')
|
name_regexp = re.compile(r'^\d+')
|
||||||
|
|
||||||
def valid_name(name):
|
def valid_name(name):
|
||||||
|
try:
|
||||||
|
name = str(name)
|
||||||
|
except:
|
||||||
|
raise ValueError("not a valid string name")
|
||||||
if re.match(name_regexp, name) is None:
|
if re.match(name_regexp, name) is None:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue