forked from platypush/platypush
🐛 The EventMatchResult
object shouldn't be initialized with args
from the event.
If there's a good use-case for overriding `Event._matches_condition` with a logic that also parses the event arguments, then those arguments should be accessed directly from the event object, not from the match result. Initializing `EventMatchResult` with the arguments from the event means that, if `EventMatchResult.parsed_args` are populated with custom extracted arguments, then the upstream event arguments will also be modified. If the event is matched against multiple conditions, this will result in the extracted tokens getting modified by each `matches_condition` iteration.
This commit is contained in:
parent
237fc58928
commit
4734909912
1 changed files with 1 additions and 1 deletions
|
@ -220,7 +220,7 @@ class Event(Message):
|
||||||
:param condition: The platypush.event.hook.EventCondition object
|
:param condition: The platypush.event.hook.EventCondition object
|
||||||
"""
|
"""
|
||||||
|
|
||||||
result = EventMatchResult(is_match=False, parsed_args=self.args)
|
result = EventMatchResult(is_match=False)
|
||||||
match_scores = []
|
match_scores = []
|
||||||
|
|
||||||
if not isinstance(self, condition.type):
|
if not isinstance(self, condition.type):
|
||||||
|
|
Loading…
Reference in a new issue