Skip to content

Commit

Permalink
fix(api): _render safe to false when there is inverted section (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
talboren authored Apr 3, 2024
1 parent 3e4e4b3 commit 04f76a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion keep/iohandler/iohandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,16 @@ def _parse(self, tree):
tree = ast.parse(token.encode("unicode_escape"))
return _parse(self, tree)

def _render(self, key, safe=False, default=""):
def _render(self, key: str, safe=False, default=""):
# change [] to . for the key because thats what chevron uses
_key = key.replace("[", ".").replace("]", "")

if "{{^" in key or "{{ ^" in key:
self.logger.debug(
"Safe render is not supported when there are inverted sections."
)
safe = False

context = self.context_manager.get_full_context()
# TODO: protect from multithreaded where another thread will print to stderr, but thats a very rare case and we shouldn't care much
original_stderr = sys.stderr
Expand Down

0 comments on commit 04f76a2

Please sign in to comment.