return classes in reverse sorting order if desired
This commit is contained in:
parent
92a96343e1
commit
a029c096c8
@ -8,7 +8,7 @@ Created by Marcus Stoegbauer on 2013-01-10.
|
||||
"""
|
||||
|
||||
import platform
|
||||
|
||||
from operator import itemgetter
|
||||
|
||||
class Checks(object):
|
||||
def __init__(self):
|
||||
@ -23,7 +23,7 @@ class Checks(object):
|
||||
|
||||
# def getShortHostname
|
||||
|
||||
def __classes_for_host__(self):
|
||||
def __classes_for_host__(self, reverse=False):
|
||||
"""docstring for __classesForHost"""
|
||||
classes = []
|
||||
for c in dir(self):
|
||||
@ -32,7 +32,7 @@ class Checks(object):
|
||||
ret = getattr(self, c)()
|
||||
if type(ret) == tuple and len(ret) == 3:
|
||||
classes.append(ret)
|
||||
return map(lambda k: (k[1], k[2]), sorted(classes, key=lambda k: k[0]))
|
||||
return map(lambda k: (k[1], k[2]), sorted(classes, key=itemgetter(0), reverse=reverse))
|
||||
|
||||
def header(self):
|
||||
"""docstring for header"""
|
||||
|
Loading…
Reference in New Issue
Block a user