Skip to content

Commit 2274a72

Browse files
Py3-only: Change str encoding from Python2 to only support Python3
Note by Bernhard: As per the agreement with Andrew in #18, we shall keep master py2-compatible and py3-only changes go to a py3 branch: Andrew wrote: > However, master needs to remain atomically py2 or py3 compatible, > and not a mix of fixes which leaves it broken in both. [...] > please keep all commits which break compatibility with py2 in a > separate single PR so it can be merged all in one go. > The final commit on the py3 branch should [...] Reference: #18 (comment) Therefore, I'll squash this commit with the next commit for fixing it up keep master py2-compatible, at least until all py3 checks and a complete manual test was done by QA. Original commit message by Qin Zhang (张琴): Remove the use of 'encode' as it's used to turn a Unicode string into a regular string in Python2 Final Remarks by Bernhard, for completeleness: - This commit also adds conversion from curses input bytes to str. - Rebased to apply on the current master branch. Co-authored-by: Bernhard Kaindl <[email protected]> Signed-off-by: Qin Zhang (张琴) <[email protected]>
1 parent f501fa8 commit 2274a72

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

XSConsoleCurses.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,11 @@ def Snapshot(self):
278278
if self.title != "":
279279
retVal.append(self.title)
280280
if self.hasBox:
281-
for i in range(1, self.ySize-1):
282-
retVal.append(self.win.instr(i, 1, self.xSize-2))
281+
for i in range(1, self.ySize - 1):
282+
retVal.append(self.win.instr(i, 1, self.xSize - 2).decode('utf-8'))
283283
else:
284284
for i in range(self.ySize):
285-
retVal.append(self.win.instr(i, 0, self.xSize))
285+
retVal.append(self.win.instr(i, 0, self.xSize).decode('utf-8'))
286286

287287
return retVal
288288

plugins-base/XSFeatureSRCommon.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def UpdateFieldsINITIAL(self):
211211
pane.ResetFields()
212212

213213
sr = HotAccessor().sr[self.srHandle]
214-
srName = sr.name_label(None).encode('utf-8')
214+
srName = sr.name_label(None)
215215
if srName is None:
216216
pane.AddTitleField(Lang("The Virtual Machine is no longer present"))
217217
else:
@@ -226,7 +226,7 @@ def UpdateFieldsCONFIRM(self):
226226
pane.ResetFields()
227227

228228
sr = HotAccessor().sr[self.srHandle]
229-
srName = sr.name_label(None).encode('utf-8')
229+
srName = sr.name_label(None)
230230
if srName is None:
231231
pane.AddTitleField(Lang("The Storage Repository is no longer present"))
232232
else:
@@ -282,7 +282,7 @@ def Commit(self):
282282
Layout.Inst().PopDialogue()
283283

284284
operationName = SRUtils.OperationName(self.operation)
285-
srName = HotAccessor().sr[self.srHandle].name_label(Lang('<Unknown>')).encode('utf-8')
285+
srName = HotAccessor().sr[self.srHandle].name_label(Lang('<Unknown>'))
286286
messagePrefix = operationName + Lang(' operation on ') + srName + ' '
287287
Layout.Inst().TransientBanner(messagePrefix+Lang('in progress...'))
288288
try:

plugins-base/XSFeatureVMCommon.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def UpdateFieldsINITIAL(self):
169169
pane.ResetFields()
170170

171171
vm = HotAccessor().guest_vm[self.vmHandle]
172-
vmName = vm.name_label(None).encode('utf-8')
172+
vmName = vm.name_label(None)
173173
if vmName is None:
174174
pane.AddTitleField(Lang("The Virtual Machine is no longer present"))
175175
else:
@@ -190,7 +190,7 @@ def UpdateFieldsCONFIRM(self):
190190
pane.ResetFields()
191191

192192
vm = HotAccessor().vm[self.vmHandle]
193-
vmName = vm.name_label(None).encode('utf-8')
193+
vmName = vm.name_label(None)
194194
if vmName is None:
195195
pane.AddTitleField(Lang("The Virtual Machine is no longer present"))
196196
else:
@@ -252,7 +252,7 @@ def Commit(self):
252252
Layout.Inst().PopDialogue()
253253

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

0 commit comments

Comments
 (0)