From 6d566d4aa1ce86c0853e6f016412f5054a9bfa7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Qin=20Zhang=20=EF=BC=88=E5=BC=A0=E7=90=B4=EF=BC=89?= Date: Tue, 14 Nov 2023 13:15:47 +0800 Subject: [PATCH] Remove the use of 'encode' as it is used to turn a Unicode string into a regular string in Python2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Qin Zhang (张琴) --- XSConsoleCurses.py | 4 ++-- XSConsoleRemoteTest.py | 2 +- plugins-base/XSFeatureSRCommon.py | 6 +++--- plugins-base/XSFeatureVMCommon.py | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/XSConsoleCurses.py b/XSConsoleCurses.py index e77ed1a..75705f9 100644 --- a/XSConsoleCurses.py +++ b/XSConsoleCurses.py @@ -279,10 +279,10 @@ def Snapshot(self): retVal.append(self.title) if self.hasBox: for i in range(1, self.ySize-1): - retVal.append(self.win.instr(i, 1, self.xSize-2)) + retVal.append(Lang(self.win.instr(i, 1, self.xSize-2))) else: for i in range(self.ySize): - retVal.append(self.win.instr(i, 0, self.xSize)) + retVal.append(Lang(self.win.instr(i, 0, self.xSize))) return retVal diff --git a/XSConsoleRemoteTest.py b/XSConsoleRemoteTest.py index 2f39506..a9288da 100644 --- a/XSConsoleRemoteTest.py +++ b/XSConsoleRemoteTest.py @@ -25,7 +25,7 @@ import xmlrpc.server class UnixSimpleXMLRPCRequestHandler(xmlrpc.server.SimpleXMLRPCRequestHandler): - # Python 2.7's SimpleXMLRPCRequestHandler enables Nagle's algorithm by default + # Python's SimpleXMLRPCRequestHandler enables Nagle's algorithm by default # which fails because we're working with Unix domain sockets so disable it. disable_nagle_algorithm = False diff --git a/plugins-base/XSFeatureSRCommon.py b/plugins-base/XSFeatureSRCommon.py index 83390de..5ec4e24 100644 --- a/plugins-base/XSFeatureSRCommon.py +++ b/plugins-base/XSFeatureSRCommon.py @@ -211,7 +211,7 @@ def UpdateFieldsINITIAL(self): pane.ResetFields() sr = HotAccessor().sr[self.srHandle] - srName = sr.name_label(None).encode('utf-8') + srName = Lang(sr.name_label(None)) if srName is None: pane.AddTitleField(Lang("The Virtual Machine is no longer present")) else: @@ -226,7 +226,7 @@ def UpdateFieldsCONFIRM(self): pane.ResetFields() sr = HotAccessor().sr[self.srHandle] - srName = sr.name_label(None).encode('utf-8') + srName = Lang(sr.name_label(None)) if srName is None: pane.AddTitleField(Lang("The Storage Repository is no longer present")) else: @@ -282,7 +282,7 @@ def Commit(self): Layout.Inst().PopDialogue() operationName = SRUtils.OperationName(self.operation) - srName = HotAccessor().sr[self.srHandle].name_label(Lang('')).encode('utf-8') + srName = Lang(HotAccessor().sr[self.srHandle].name_label(Lang(''))) messagePrefix = operationName + Lang(' operation on ') + srName + ' ' Layout.Inst().TransientBanner(messagePrefix+Lang('in progress...')) try: diff --git a/plugins-base/XSFeatureVMCommon.py b/plugins-base/XSFeatureVMCommon.py index 108938c..23d75f2 100644 --- a/plugins-base/XSFeatureVMCommon.py +++ b/plugins-base/XSFeatureVMCommon.py @@ -162,7 +162,7 @@ def UpdateFieldsINITIAL(self): pane.ResetFields() vm = HotAccessor().guest_vm[self.vmHandle] - vmName = vm.name_label(None).encode('utf-8') + vmName = Lang(vm.name_label(None)) if vmName is None: pane.AddTitleField(Lang("The Virtual Machine is no longer present")) else: @@ -183,7 +183,7 @@ def UpdateFieldsCONFIRM(self): pane.ResetFields() vm = HotAccessor().vm[self.vmHandle] - vmName = vm.name_label(None).encode('utf-8') + vmName = Lang(vm.name_label(None)) if vmName is None: pane.AddTitleField(Lang("The Virtual Machine is no longer present")) else: @@ -245,7 +245,7 @@ def Commit(self): Layout.Inst().PopDialogue() operationName = VMUtils.OperationName(self.operation) - vmName = HotAccessor().guest_vm[self.vmHandle].name_label(Lang('')).encode('utf-8') + vmName = HotAccessor().guest_vm[self.vmHandle].name_label(Lang('')) messagePrefix = operationName + Lang(' operation on ') + vmName + ' ' try: task = VMUtils.AsyncOperation(self.operation, self.vmHandle, *self.opParams)