Skip to content

Plugin

ContactPlugin ΒΆ

Bases: SingletonPlugin

CKAN Contact Extension.

Source code in ckanext/contact/plugin.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class ContactPlugin(SingletonPlugin):
    """
    CKAN Contact Extension.
    """

    implements(interfaces.IBlueprint, inherit=True)
    implements(interfaces.IConfigurer)
    implements(interfaces.IAuthFunctions)
    implements(interfaces.ITemplateHelpers, inherit=True)

    ## IConfigurer
    def update_config(self, config):
        toolkit.add_template_directory(config, 'theme/templates')
        toolkit.add_resource('theme/assets', 'ckanext-contact')

    ## IBlueprint
    def get_blueprint(self):
        return routes.blueprints

    ## IAuthFunctions
    def get_auth_functions(self):
        return {'send_contact': send_contact}

    ## ITemplateHelpers
    def get_helpers(self):
        return {
            'get_recaptcha_v3_action': functools.partial(
                toolkit.config.get, 'ckanext.contact.recaptcha_v3_action', None
            ),
            'get_recaptcha_v3_key': functools.partial(
                toolkit.config.get, 'ckanext.contact.recaptcha_v3_key', None
            ),
        }