features: add vm.features.items() function

Make it behave more like a dict.
This commit is contained in:
Marek Marczykowski-Górecki 2017-05-22 03:10:34 +02:00
parent c826378579
commit 17ca883c7c
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -60,6 +60,11 @@ class Features(object):
keys = __iter__
def items(self):
'''Return iterable of pairs (feature, value)'''
for key in self:
yield key, self[key]
_NO_DEFAULT = object()
def check_with_template(self, feature, default=_NO_DEFAULT):