'Build email digest content'

def get_msg_html(self):

    frappe.flags.ignore_account_permission = True
    from erpnext.setup.doctype.email_digest.quotes import get_random_quote
    context = frappe._dict()
    context.update(self.__dict__)
    self.set_title(context)
    self.set_style(context)
    self.set_accounting_cards(context)
    if self.get(u'calendar_events'):
        (context.events, context.event_count) = self.get_calendar_events()
    if self.get(u'todo_list'):
        context.todo_list = self.get_todo_list()
        context.todo_count = self.get_todo_count()
    if self.get(u'notifications'):
        context.notifications = self.get_notifications()
    if self.get(u'issue'):
        context.issue_list = self.get_issue_list()
        context.issue_count = self.get_issue_count()
    if self.get(u'project'):
        context.project_list = self.get_project_list()
        context.project_count = self.get_project_count()
    quote = get_random_quote()
    context.quote = {u'text': quote[0], u'author': quote[1]}
    if (not (context.events or context.todo_list or context.notifications or context.cards)):
        return None
    frappe.flags.ignore_account_permission = False
    return frappe.render_template(u'erpnext/setup/doctype/email_digest/templates/default.html', context, is_path=True)
