File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed
Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ requests = "2.32.4" # Mitigates security vuln in < 2.31.0
3939schedula = " 1.2.19"
4040sqlalchemy = " 2.0.19"
4141typing_extensions = " 4.6.2"
42- urllib3 = " 2.5 .0" # Mitigates security vuln in < 1.26.19
42+ urllib3 = " 2.6 .0" # Mitigates security vuln in < 2.5.0
4343xmltodict = " 0.13.0"
4444
4545[tool .poetry .group .dev ]
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ class BaseReportingConfig(BaseModel):
2828
2929 """
3030
31- UNTEMPLATED_FIELDS : ClassVar [set [str ]] = { "message" }
31+ UNTEMPLATED_FIELDS : ClassVar [set [str ]] = set ()
3232 """Fields that should not be templated."""
3333
3434 emit : Optional [str ] = None
Original file line number Diff line number Diff line change 1111from dve .core_engine .type_hints import JSONable , TemplateVariables
1212
1313
14+ class PreserveTemplateUndefined (jinja2 .Undefined ):
15+ """
16+ Preserve the original template in instances where the value cannot be populated. Whilst this
17+ may result in templates coming back in the FeedbackMessage object, it's more useful to know
18+ exactly what should have been populated rather than just returning blank values.
19+ """
20+ def __str__ (self ):
21+ return "{{" + self ._undefined_name + "}}"
22+
23+
1424class RuleTemplateError (ValueError ):
1525 """A rule template error."""
1626
@@ -21,7 +31,10 @@ def _raise_rule_templating_error(message: str) -> NoReturn:
2131
2232
2333T = TypeVar ("T" , bound = JSONable )
24- ENVIRONMENT = jinja2 .Environment (autoescape = False )
34+ ENVIRONMENT = jinja2 .Environment (
35+ autoescape = jinja2 .select_autoescape (default_for_string = False ),
36+ undefined = PreserveTemplateUndefined ,
37+ )
2538ENVIRONMENT .globals ["repr" ] = repr
2639ENVIRONMENT .globals ["str" ] = str
2740ENVIRONMENT .globals ["raise" ] = _raise_rule_templating_error
You can’t perform that action at this time.
0 commit comments