Beispiel #1
0
import json
import logging

from flask_mail import Message

import features

from _init import ROOT_DIR
from app import mail, app, get_app_url
from util.jinjautil import get_template_env
from util.html import html2text


logger = logging.getLogger(__name__)

template_env = get_template_env(os.path.join(ROOT_DIR, "emails"))


class CannotSendEmailException(Exception):
    pass


class GmailAction(object):
    """
    Represents an action that can be taken in Gmail in response to the email.
    """

    def __init__(self, metadata):
        self.metadata = metadata

    @staticmethod
Beispiel #2
0
import logging
import time
import re

from datetime import datetime
from notifications import build_repository_event_data
from util.jinjautil import get_template_env
from util.secscan import PRIORITY_LEVELS, get_priority_for_index

logger = logging.getLogger(__name__)

TEMPLATE_ENV = get_template_env("events")


class InvalidNotificationEventException(Exception):
    pass


class NotificationEvent(object):
    def __init__(self):
        pass

    def get_level(self, event_data, notification_data):
        """
    Returns a 'level' representing the severity of the event.
    Valid values are: 'info', 'warning', 'error', 'primary', 'success'
    """
        raise NotImplementedError

    def get_summary(self, event_data, notification_data):
        """