cubicweb_graphql/hooks.py
author Laurent Wouters <lwouters@cenotelie.fr>
Wed, 29 Apr 2020 12:02:46 +0200
changeset 13 112639729734
parent 1 3fc6832162c2
permissions -rw-r--r--
Fix import style for Python 3

# -*- coding: utf-8 -*-
# copyright 2018 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""cubicweb-graphql specific hooks and operations"""

from cubicweb.server import hook

from cubicweb_graphql.querier import GraphQLQuerier


class GraphQLStartupHook(hook.Hook):
    """
    Hook for the startup of the GraphQL querier
    """

    __regid__ = 'cw.graphql.startup'
    events = ('server_startup',)

    def __call__(self):
        GraphQLQuerier.register(self.repo)