コード例 #1
0
    def init_backend(self, options=None):
        """Use options to create a new mailer backend."""
        options = get_config(options or {})

        backend_path = options.pop('backend', None)
        backend_class = import_path(backend_path)
        if backend_class is None:
            raise RuntimeError("Invalid backend: '%s'" % backend_path)

        return backend_class(**options)
コード例 #2
0
ファイル: test_util.py プロジェクト: vitalk/flask-mailer
def test_get_config_trim_prefixes_from_config_keys(config):
    assert get_config(config) == {
            'backend': 'flask_mailer.backends.dummy.DummyMailer',
            'default_sender': 'webmaster',
            'host': 'localhost',
            'password': None,
            'port': 25,
            'testing': True,
            'use_tls': False,
            'username': None }
コード例 #3
0
ファイル: __init__.py プロジェクト: TeZzo1/MQTT
    def init_backend(self, options=None):
        """Use options to create a new mailer backend."""
        options = get_config(options or {})

        backend_path = options.pop('backend', None)
        backend_class = import_path(backend_path)
        if backend_class is None:
            raise RuntimeError("Invalid backend: '%s'" % backend_path)

        return backend_class(**options)
コード例 #4
0
ファイル: test_util.py プロジェクト: vitalk/flask-mailer
def test_get_config_convert_keys_to_lowercase(config):
    for key, value in get_config(config).items():
        assert key.islower()