From 4fde70882f3c22c88552177c463bc163c315dcc3 Mon Sep 17 00:00:00 2001 From: Stephen Cheng Date: Fri, 7 Jun 2024 04:01:10 +0100 Subject: [PATCH] CA-388527: Keep python2 and python3 compatibility The PR https://github.com/xapi-project/xsconsole/pull/42 uses keyword-only argument which is not supported in Python2 In XS8, we still uses python2, so fix this to work both in python2 and python3 Signed-off-by: Stephen Cheng --- XSConsoleDialogueBases.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/XSConsoleDialogueBases.py b/XSConsoleDialogueBases.py index 0b558ce..f56bd57 100644 --- a/XSConsoleDialogueBases.py +++ b/XSConsoleDialogueBases.py @@ -634,13 +634,13 @@ def HandleSRChoice(self, inChoice): self.DoAction(self.choices[inChoice].sr) class ProgressDialogue(Dialogue): - def __init__(self, inTask, inText, *args, OnComplete=None): + def __init__(self, inTask, inText, *args, **kwargs): Dialogue.__init__(self) self.task = inTask self.text = inText # OnComplete is a function to call when the task completes # Used for getting task result and do something after the task completes - self.OnComplete = OnComplete + self.OnComplete = kwargs.get('OnComplete', None) self.args = args # Arguments to pass to OnComplete self.ChangeState('INITIAL')