python3: add new type of authorized node in condition validator
This commit is contained in:
parent
5dde723192
commit
c6355659d9
|
@ -149,6 +149,13 @@ class ConditionValidator(BaseExpressionValidator):
|
|||
ast.Compare,
|
||||
]
|
||||
|
||||
def __init__(self, authorized_nodes=None, forbidden_nodes=None):
|
||||
super(ConditionValidator, self).__init__(
|
||||
authorized_nodes=authorized_nodes,
|
||||
forbidden_nodes=forbidden_nodes)
|
||||
if six.PY3:
|
||||
self.authorized_nodes.append(ast.NameConstant)
|
||||
|
||||
def check_Name(self, node):
|
||||
if node.id.startswith('_'):
|
||||
raise ExpressionError(_('name must not start with a _'), code='invalid-variable', node=node)
|
||||
|
|
Loading…
Reference in New Issue