Exemplo n.º 1
0
def set_constraint_el_to_string(constraint_el, showDetail=False):
    set_list = []
    for set_el in constraint_el.getElementsByTagName("resource_set"):
        set_list.append("set " + " ".join([
            res_el.getAttribute("id")
            for res_el in set_el.getElementsByTagName("resource_ref")
        ] + utils.dom_attrs_to_list(set_el, showDetail)))
    constraint_opts = utils.dom_attrs_to_list(constraint_el, False)
    if constraint_opts:
        constraint_opts.insert(0, "setoptions")
    if showDetail:
        constraint_opts.append("(id:%s)" % constraint_el.getAttribute("id"))
    return " ".join(set_list + constraint_opts)
Exemplo n.º 2
0
def set_constraint_el_to_string(constraint_el, showDetail=False):
    set_list = []
    for set_el in constraint_el.getElementsByTagName("resource_set"):
        set_list.append("set " + " ".join(
            [
                res_el.getAttribute("id")
                for res_el in set_el.getElementsByTagName("resource_ref")
            ]
            +
            utils.dom_attrs_to_list(set_el, showDetail)
        ))
    constraint_opts = utils.dom_attrs_to_list(constraint_el, False)
    if constraint_opts:
        constraint_opts.insert(0, "setoptions")
    if showDetail:
        constraint_opts.append("(id:%s)" % constraint_el.getAttribute("id"))
    return " ".join(set_list + constraint_opts)
Exemplo n.º 3
0
 def list_attributes(self, element):
     attributes = utils.dom_attrs_to_list(element, with_id=False)
     # sort it always to get the same output for the same input as dict is
     # unordered
     attributes.sort()
     return attributes
Exemplo n.º 4
0
 def list_attributes(self, element):
     attributes = utils.dom_attrs_to_list(element, with_id=False)
     if self.show_detail:
         attributes.append(" (id:%s)" % (element.getAttribute("id")))
     return attributes
Exemplo n.º 5
0
Arquivo: rule.py Projeto: tradej/pcs
 def list_attributes(self, element):
     attributes = utils.dom_attrs_to_list(element, with_id=False)
     if self.normalize:
         attributes.sort()
     return attributes
Exemplo n.º 6
0
Arquivo: rule.py Projeto: ingted/pcs
 def list_attributes(self, element):
     attributes = utils.dom_attrs_to_list(element, with_id=False)
     if self.normalize:
         attributes.sort()
     return attributes
Exemplo n.º 7
0
Arquivo: rule.py Projeto: ingted/pcs
 def list_attributes(self, element):
     attributes = utils.dom_attrs_to_list(element, with_id=False)
     if self.show_detail:
         attributes.append(" (id:%s)" % (element.getAttribute("id")))
     return attributes