Make names always 'str'

Regardless of python version, always have names as 'str' type.
This commit is contained in:
Marek Marczykowski-Górecki 2017-03-13 04:28:13 +01:00
parent e7d89bcc0d
commit 9a26eec1ac
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
3 changed files with 6 additions and 3 deletions

View File

@ -60,6 +60,7 @@ class VMCollection(object):
# FIXME: this will probably change
for vm_data in vm_list_data.splitlines():
vm_name, props = vm_data.decode('ascii').split(' ', 1)
vm_name = str(vm_name)
props = props.split(' ')
new_vm_list[vm_name] = dict(
[vm_prop.split('=', 1) for vm_prop in props])

View File

@ -257,7 +257,7 @@ class WrapperObjectsCollection(object):
list_data = self.app.qubesd_call('dom0', self._list_method)
list_data = list_data.decode('ascii')
assert list_data[-1] == '\n'
self._names_list = list_data[:-1].splitlines()
self._names_list = [str(name) for name in list_data[:-1].splitlines()]
for name, obj in list(self._objects.items()):
if obj.name not in self._names_list:

View File

@ -92,7 +92,7 @@ class Volume(object):
return self._pool
else:
self._fetch_info()
return self._info['pool']
return str(self._info['pool'])
@property
def vid(self):
@ -101,7 +101,7 @@ class Volume(object):
return self._vid
else:
self._fetch_info()
return self._info['vid']
return str(self._info['vid'])
@property
def size(self):
@ -202,6 +202,8 @@ class Pool(object):
def __eq__(self, other):
if isinstance(other, Pool):
return self.name == other.name
elif isinstance(other, str):
return self.name == other
return NotImplemented
def __lt__(self, other):