2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-26 03:19:48 +00:00

Add check for invalid dotted attribute names in expressions

This provides better feedback for typos and mistakes.
This commit is contained in:
Jarrod Johnson 2018-01-26 17:00:03 -05:00
parent 68d469788d
commit 9e467c5e57

View File

@ -424,6 +424,10 @@ class _ExpressionFormat(string.Formatter):
key = '.' + left.attr + key
left = left.value
key = left.id + key
if (not key.startswith('custom.') and
_get_valid_attrname(key) not in allattributes.node):
raise ValueError(
'{0} is not a valid attribute name'.format(key))
val = self._expand_attribute(key)
return val['value'] if val and 'value' in val else ""
elif isinstance(node, ast.Name):