qubes/tools/qvm_ls: fix getting columns from mixin

This commit is contained in:
Wojtek Porczyk 2016-01-21 15:13:33 +01:00
parent 21d6d51cbb
commit 6bc30b2e0b

View File

@ -198,29 +198,32 @@ def process_class(cls):
:param qubes.vm.BaseVMMeta cls: Class to round up. :param qubes.vm.BaseVMMeta cls: Class to round up.
''' '''
for prop in cls.__dict__.values(): for klass in cls.__mro__:
holder = prop.fget if isinstance(prop, __builtin__.property) else prop for prop in klass.__dict__.values():
if not hasattr(holder, 'ls_head') or holder.ls_head is None: holder = prop.fget \
continue if isinstance(prop, __builtin__.property) \
else prop
for col in Column.columns.values(): if not hasattr(holder, 'ls_head') or holder.ls_head is None:
if not isinstance(col, PropertyColumn):
continue continue
if col.holder.__name__ != holder.__name__: for col in Column.columns.values():
continue if not isinstance(col, PropertyColumn):
continue
if col.ls_head != holder.ls_head: if col.holder.__name__ != holder.__name__:
raise TypeError('Found column head mismatch in class {!r} ' continue
'({!r} != {!r})'.format(cls.__name__,
holder.ls_head, col.ls_head))
if col.ls_width != holder.ls_width: if col.ls_head != holder.ls_head:
raise TypeError('Found column width mismatch in class {!r} ' raise TypeError('Found column head mismatch in class {!r} '
'({!r} != {!r})'.format(cls.__name__, '({!r} != {!r})'.format(cls.__name__,
holder.ls_width, col.ls_width)) holder.ls_head, col.ls_head))
PropertyColumn(holder) if col.ls_width != holder.ls_width:
raise TypeError('Found column width mismatch in class {!r} '
'({!r} != {!r})'.format(cls.__name__,
holder.ls_width, col.ls_width))
PropertyColumn(holder)
def flag(field): def flag(field):