qubes/vm: put name= first in __repr__

This is to have it in case the repr is truncated.
This commit is contained in:
Wojtek Porczyk 2017-09-19 17:02:19 +02:00
parent bd123a3812
commit 71eefbea14

View File

@ -384,14 +384,16 @@ class BaseVM(qubes.PropertyHolder):
def __repr__(self): def __repr__(self):
proprepr = [] proprepr = []
for prop in self.property_list(): for prop in self.property_list():
if prop.__name__ in ('name', 'qid'):
continue
try: try:
proprepr.append('{}={!s}'.format( proprepr.append('{}={!s}'.format(
prop.__name__, getattr(self, prop.__name__))) prop.__name__, getattr(self, prop.__name__)))
except AttributeError: except AttributeError:
continue continue
return '<{} object at {:#x} {}>'.format( return '<{} at {:#x} name={!r} qid={!r} {}>'.format(type(self).__name__,
self.__class__.__name__, id(self), ' '.join(proprepr)) id(self), self.name, self.qid, ' '.join(proprepr))
# #
# xml serialising methods # xml serialising methods