Fix substitutions

This commit is contained in:
Otto Winter 2018-11-30 12:40:33 +01:00
parent 5e3bc4ed2b
commit 20c307acc4
No known key found for this signature in database
GPG key ID: DB66C0BE6013F97E

View file

@ -19,10 +19,10 @@ def validate_substitution_key(value):
value = cv.string(value) value = cv.string(value)
if not value: if not value:
raise vol.Invalid("Substitution key must not be empty") raise vol.Invalid("Substitution key must not be empty")
if value[0].isdigit():
raise vol.Invalid("First character in substitutions cannot be a digit.")
if value[0] == '$': if value[0] == '$':
value = value[1:] value = value[1:]
if value[0].isdigit():
raise vol.Invalid("First character in substitutions cannot be a digit.")
for char in value: for char in value:
if char not in VALID_SUBSTITUTIONS_CHARACTERS: if char not in VALID_SUBSTITUTIONS_CHARACTERS:
raise vol.Invalid( raise vol.Invalid(