예제 #1
0
 def create_report(self):
     """
     Using a Jinja template (jinja_audit_email.html), create a report that can be emailed.
     :return: HTML - The output of the rendered template.
     """
     jenv = get_jinja_env()
     template = jenv.get_template('jinja_audit_email.html')
     # This template expects a list of items that have been sorted by total score in
     # decending order.
     for item in self.items:
         item.totalscore = 0
         for issue in item.audit_issues:
             item.totalscore = item.totalscore + issue.score
     sorted_list = sorted(self.items, key=lambda item: item.totalscore)
     sorted_list.reverse()
     report_list = []
     for item in sorted_list:
         if item.totalscore > 0:
             report_list.append(item)
         else:
             break
     if len(report_list) > 0:
         return template.render({'items': report_list})
     else:
         return False
예제 #2
0
    def create_report(self):
        """
        Using a Jinja template (jinja_audit_email.html), create a report that can be emailed.
        :return: HTML - The output of the rendered template.
        """
        jenv = get_jinja_env()
        template = jenv.get_template('jinja_audit_email.html')

        for item in self.items:
            item.reportable_issues = list()
            item.score = 0
            for issue in item.db_item.issues:
                if issue.fixed or issue.auditor_setting.disabled:
                    continue
                if not app.config.get('EMAIL_AUDIT_REPORTS_INCLUDE_JUSTIFIED',
                                      True) and issue.justified:
                    continue
                item.reportable_issues.append(issue)
                item.score += issue.score

        sorted_list = sorted(self.items,
                             key=lambda item: item.score,
                             reverse=True)
        report_list = [item for item in sorted_list if (item.score)]

        if report_list:
            return template.render({'items': report_list})
        return False
예제 #3
0
    def create_report(self):
        """
        Using a Jinja template (jinja_audit_email.html), create a report that can be emailed.
        :return: HTML - The output of the rendered template.
        """
        jenv = get_jinja_env()
        template = jenv.get_template('jinja_audit_email.html')

        for item in self.items:
            item.reportable_issues = list()
            item.score = 0
            for issue in item.db_item.issues:
                if issue.fixed or issue.auditor_setting.disabled:
                    continue
                if not app.config.get('EMAIL_AUDIT_REPORTS_INCLUDE_JUSTIFIED', True) and issue.justified:
                    continue
                item.reportable_issues.append(issue)
                item.score += issue.score

        sorted_list = sorted(self.items, key=lambda item: item.score, reverse=True)
        report_list = [item for item in sorted_list if item.score > 0]

        if report_list:
            return template.render({'items': report_list})
        return False
예제 #4
0
 def create_report(self):
     """
     Using a Jinja template (jinja_audit_email.html), create a report that can be emailed.
     :return: HTML - The output of the rendered template.
     """
     jenv = get_jinja_env()
     template = jenv.get_template('jinja_audit_email.html')
     # This template expects a list of items that have been sorted by total score in
     # descending order.
     for item in self.items:
         item.totalscore = 0
         for issue in item.db_item.issues:
             item.totalscore = item.totalscore + issue.score
     sorted_list = sorted(self.items, key=lambda item: item.totalscore)
     sorted_list.reverse()
     report_list = []
     for item in sorted_list:
         if item.totalscore > 0:
             report_list.append(item)
         else:
             break
     if len(report_list) > 0:
         return template.render({'items': report_list})
     else:
         return False
예제 #5
0
 def description(self):
     """
     Provide an HTML description of the object for change emails and the Jinja templates.
     :return: string of HTML desribing the object.
     """
     jenv = get_jinja_env()
     template = jenv.get_template("jinja_change_item.html")
     body = template.render(self._dict_for_template())
     # app.logger.info(body)
     return body
예제 #6
0
 def description(self):
     """
     Provide an HTML description of the object for change emails and the Jinja templates.
     :return: string of HTML describing the object.
     """
     jenv = get_jinja_env()
     template = jenv.get_template('jinja_change_item.html')
     body = template.render(self._dict_for_template())
     # app.logger.info(body)
     return body
def report_content(content):
    jenv = get_jinja_env()
    template = jenv.get_template('jinja_change_email.html')
    body = template.render(content)
    # app.logger.info(body)
    return body
예제 #8
0
 def report_content(self, content):
     jenv = get_jinja_env()
     template = jenv.get_template('jinja_change_email.html')
     body = template.render(content)
     #app.logger.info(body)
     return body
예제 #9
0
def report_content(content, issues_only=False):
    jenv = get_jinja_env()
    template = jenv.get_template('jinja_change_email.html')
    body = template.render(content, issues_only=issues_only)
    # app.logger.info(body)
    return body