Skip to content

Commit

Permalink
Fix bug when trying to set undefined value in state in jinja event pl…
Browse files Browse the repository at this point in the history
…ugin
  • Loading branch information
rnv812 committed May 31, 2024
1 parent 8bcd3b6 commit 257ef7e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion eventum_plugins/event/jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
load_csv_sample)
from jinja2 import (BaseLoader, Environment, FileSystemLoader, Template,
TemplateError, TemplateNotFound, TemplateRuntimeError,
TemplateSyntaxError)
TemplateSyntaxError, Undefined)
from pydantic import Field, field_validator

from eventum_plugins.event.base import (BaseEventPlugin, EventPluginBaseConfig,
Expand Down Expand Up @@ -126,6 +126,9 @@ def __init__(self) -> None:

def set(self, key: str, value: Any) -> None:
"""Set variable value to state."""
if isinstance(value, Undefined):
value = None

self._state[key] = value

def get(self, key: str, default: Any | None = None) -> Any:
Expand Down

0 comments on commit 257ef7e

Please sign in to comment.