Corrected DialogContext.cancel_all_dialogs
@@ -219,11 +219,8 @@ class DialogContext:
:param event_value:
:return:
"""
- # pylint: disable=too-many-nested-blocks
try:
- if cancel_parents is None:
event_name = event_name or DialogEvents.cancel_dialog
-
if self.stack or self.parent:
# Cancel all local and parent dialogs while checking for interception
notify = False
@@ -234,10 +231,7 @@ class DialogContext:
# Check to see if the dialog wants to handle the event
if notify:
event_handled = await dialog_context.emit_event(
- event_name,
- event_value,
- bubble=False,
- from_leaf=False,
+ event_name, event_value, bubble=False, from_leaf=False,
)
if event_handled:
@@ -255,14 +249,8 @@ class DialogContext:
notify = True
return DialogTurnResult(DialogTurnStatus.Cancelled)
- # Stack was empty and no parent
- return DialogTurnResult(DialogTurnStatus.Empty)
-
- if self.stack:
- while self.stack:
- await self.end_active_dialog(DialogReason.CancelCalled)
- return DialogTurnResult(DialogTurnStatus.Cancelled)
+ # Stack was empty and no parent
return DialogTurnResult(DialogTurnStatus.Empty)
except Exception as err:
self.__set_exception_context_data(err)
