예제 #1
0
파일: views.py 프로젝트: vishu77/adagios
def _querystring_to_objects(dictionary):
    """ Finds all nagios objects in a querystring and returns a list of objects

    >>> dictionary = {'host':('localhost1', 'localhost2'),}
    >>> print _querystring_to_objects
    {'host':('localhost1','localhost2')}
    """
    result = []
    Object = namedtuple('Object', 'object_type description')
    for object_type in string_to_class.keys():
        objects = dictionary.getlist(object_type)
        for i in objects:
            obj = (Object(object_type, i))
            result.append(obj)
    return result
예제 #2
0
파일: views.py 프로젝트: haukurk/adagios
def _querystring_to_objects(dictionary):
    """ Finds all nagios objects in a querystring and returns a list of objects

    >>> dictionary = {'host':('localhost1', 'localhost2'),}
    >>> print _querystring_to_objects
    {'host':('localhost1','localhost2')}
    """
    result = []
    Object = namedtuple('Object', 'object_type description')
    for object_type in string_to_class.keys():
        objects = dictionary.getlist(object_type)
        for i in objects:
            obj = (Object(object_type, i))
            result.append(obj)
    return result