better name's validation

This commit is contained in:
2013-12-09 17:55:52 +01:00
parent 6e4f19eebe
commit bb1f6947e3
2 changed files with 25 additions and 3 deletions

View File

@@ -40,9 +40,7 @@ forbidden_names = ('iter_all', 'iter_group', 'find', 'find_first',
def valid_name(name):
"an option's name is a str and does not start with 'impl' or 'cfgimpl'"
try:
name = str(name)
except:
if not isinstance(name, str):
return False
if re.match(name_regexp, name) is None and not name.startswith('_') \
and name not in forbidden_names \