Skip to content

Commit

Permalink
Remove the use of 'encode' as it is used to turn a Unicode string int…
Browse files Browse the repository at this point in the history
…o a regular string in Python2

Signed-off-by: Qin Zhang (张琴) <[email protected]>
  • Loading branch information
qinz0822 committed Nov 14, 2023
1 parent 4f85d7e commit 6d566d4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions XSConsoleCurses.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion XSConsoleRemoteTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions plugins-base/XSFeatureSRCommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -282,7 +282,7 @@ def Commit(self):
Layout.Inst().PopDialogue()

operationName = SRUtils.OperationName(self.operation)
srName = HotAccessor().sr[self.srHandle].name_label(Lang('<Unknown>')).encode('utf-8')
srName = Lang(HotAccessor().sr[self.srHandle].name_label(Lang('<Unknown>')))
messagePrefix = operationName + Lang(' operation on ') + srName + ' '
Layout.Inst().TransientBanner(messagePrefix+Lang('in progress...'))
try:
Expand Down
6 changes: 3 additions & 3 deletions plugins-base/XSFeatureVMCommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -245,7 +245,7 @@ def Commit(self):
Layout.Inst().PopDialogue()

operationName = VMUtils.OperationName(self.operation)
vmName = HotAccessor().guest_vm[self.vmHandle].name_label(Lang('<Unknown>')).encode('utf-8')
vmName = HotAccessor().guest_vm[self.vmHandle].name_label(Lang('<Unknown>'))
messagePrefix = operationName + Lang(' operation on ') + vmName + ' '
try:
task = VMUtils.AsyncOperation(self.operation, self.vmHandle, *self.opParams)
Expand Down

0 comments on commit 6d566d4

Please sign in to comment.