Example #1
0
        if mail_config["enrichment_conditional"]:
            for i, j in mail_config["enrichments"].iteritems():
                if eval(i):
                    any_cond_match = True
                    for e in j:
                        e_enable = e.get("enabled", True)
                        if e_enable:
                            params = e["e_key"].split(",")
                            fn_params = []
                            for p in params:
                                if p.strip():
                                    fn_params.append(document[p.strip()])
                            e_func = getattr(modu, e['e_func'])
                            print "Running Enrichment: %s" % e['e_func']
                            data = e_func(*fn_params)
                            module_html = modu.generate_html(
                                e['e_name'], data, device)
                            mail_html += module_html
                    break

            if not any_cond_match:
                mail_html += "<i>No Condition matched for Enrichment</i><br><br>"
        else:
            for e in mail_config["enrichments"]:
                e_enable = e.get("enabled", True)

                if e_enable:
                    params = e["e_key"].split(",")
                    fn_params = []

                    for p in params:
                        if p.strip():