(self, process, access="allow", project_code=None, pipeline_code=None)
check before adding a new node since the user can uncheck and check again
check before adding a new node since the user can uncheck and check again
check before adding a new node since the user can uncheck and check again
def add_process(self, process, access="allow", project_code=None, pipeline_code=None):
        '''check before adding a new node since the user can uncheck and check again'''

        pipeline_code_expr = ''
        if pipeline_code:
            pipeline_code_expr = "and @pipeline='%s'"%pipeline_code

        project_code_expr = ''
        if project_code:
            project_code_expr = "and @project='%s'"%project_code

        check_node = self.xml.get_node("rules/rule[@group='process' and @process='%s' %s %s]" % (process, pipeline_code_expr, project_code_expr))
        if check_node is None:
            rule = self.xml.create_element("rule")
            self.xml.set_attribute(rule, "group", "process")
            self.xml.set_attribute(rule, "process", process)
            if project_code:
                self.xml.set_attribute(rule, "project", project_code)
            if pipeline_code:
                self.xml.set_attribute(rule, "pipeline", pipeline_code)
            self.xml.set_attribute(rule, "access", access)
            self.xml.append_child(self.root, rule)
def add_process ( self , process , access = "allow" , project_code = None , pipeline_code = None ) : pipeline_code_expr = '' if pipeline_code : pipeline_code_expr = "and @pipeline='%s'" % pipeline_code project_code_expr = '' if project_code : project_code_expr = "and @project='%s'" % project_code check_node = self . xml . get_node ( "rules/rule[@group='process' and @process='%s' %s %s]" % ( process , pipeline_code_expr , project_code_expr ) ) if check_node is None : rule = self . xml . create_element ( "rule" ) self . xml . set_attribute ( rule , "group" , "process" ) self . xml . set_attribute ( rule , "process" , process ) if project_code : self . xml . set_attribute ( rule , "project" , project_code ) if pipeline_code : self . xml . set_attribute ( rule , "pipeline" , pipeline_code ) self . xml . set_attribute ( rule , "access" , access ) self . xml . append_child ( self . root , rule )