fixes to tokens

This commit is contained in:
dgtlmoon
2022-12-04 10:45:56 +01:00
parent 4f602ff69a
commit 658a88f895
2 changed files with 4 additions and 3 deletions

View File

@@ -220,9 +220,10 @@ class ValidateJinja2Template(object):
f"The following tokens used in the notification are not valid: {undefined}" f"The following tokens used in the notification are not valid: {undefined}"
) )
regex = re.compile('{.*?}') regex = re.compile('{{(.*?)}}')
valid_tokens = list(notification.valid_tokens.keys())
for p in re.findall(regex, field.data): for p in re.findall(regex, field.data):
if not p.strip('{}') in notification.valid_tokens: if not p.strip() in valid_tokens:
message = field.gettext('Token \'%s\' is not a valid token.') message = field.gettext('Token \'%s\' is not a valid token.')
raise ValidationError(message % (p)) raise ValidationError(message % (p))

View File

@@ -85,7 +85,7 @@
<td>The diff output - differences only</td> <td>The diff output - differences only</td>
</tr> </tr>
<tr> <tr>
<td><code>{{ '{diff_full}' }}</code></td> <td><code>{{ '{{ diff_full }}' }}</code></td>
<td>The diff output - full difference output</td> <td>The diff output - full difference output</td>
</tr> </tr>
<tr> <tr>