Ejemplo n.º 1
0
    def get_Rule(self, slist, bookmark, weight):
        def logged_match(m, file, variables):
            common.debug("Testing %s against %s rule (%s)" % (file, self.match_token[0], " ".join(slist)))
            return m(file, variables)

        r = Rule()
        match = self.get_match_function(slist, {"bookmark": bookmark, "weight": weight})
        if match is not None:
            r.bookmark = bookmark
            r.weight = weight
            r.text = " ".join(slist)
            r.match_func = lambda file, variables: logged_match(match, file, variables)
            r.match_token = self.match_token[0]
            return r