'Add a directive method to the configurator.
.. warning:: This method is typically only used by :app:`Pyramid`
framework extension authors, not by :app:`Pyramid` application
developers.
Framework extenders can add directive methods to a configurator by
instructing their users to call ``config.add_directive(\'somename\',
\'some.callable\')``.  This will make ``some.callable`` accessible as
``config.somename``.  ``some.callable`` should be a function which
accepts ``config`` as a first argument, and arbitrary positional and
keyword arguments following.  It should use config.action as
necessary to perform actions.  Directive methods can then be invoked
like \'built-in\' directives such as ``add_view``, ``add_route``, etc.
The ``action_wrap`` argument should be ``True`` for directives which
perform ``config.action`` with potentially conflicting
discriminators.  ``action_wrap`` will cause the directive to be
wrapped in a decorator which provides more accurate conflict
cause information.
``add_directive`` does not participate in conflict detection, and
later calls to ``add_directive`` will override earlier calls.'

def add_directive(self, name, directive, action_wrap=True):

    c = self.maybe_dotted(directive)
    if (not hasattr(self.registry, '_directives')):
        self.registry._directives = {}
    self.registry._directives[name] = (c, action_wrap)
