'When you pass a non-``None`` ``registry`` argument to the
:term:`Configurator` constructor, no initial setup is performed
against the registry.  This is because the registry you pass in may
have already been initialized for use under :app:`Pyramid` via a
different configurator.  However, in some circumstances (such as when
you want to use a global registry instead of a registry created as a
result of the Configurator constructor), or when you want to reset
the initial setup of a registry, you *do* want to explicitly
initialize the registry associated with a Configurator for use under
:app:`Pyramid`.  Use ``setup_registry`` to do this initialization.
``setup_registry`` configures settings, a root factory, security
policies, renderers, a debug logger, a locale negotiator, and various
other settings using the configurator\'s current registry, as per the
descriptions in the Configurator constructor.'

def setup_registry(self, settings=None, root_factory=None, authentication_policy=None, authorization_policy=None, renderers=None, debug_logger=None, locale_negotiator=None, request_factory=None, response_factory=None, default_permission=None, session_factory=None, default_view_mapper=None, exceptionresponse_view=default_exceptionresponse_view):

    registry = self.registry
    self._fix_registry()
    self._set_settings(settings)
    if isinstance(debug_logger, string_types):
        debug_logger = logging.getLogger(debug_logger)
    if (debug_logger is None):
        debug_logger = logging.getLogger(self.package_name)
    registry.registerUtility(debug_logger, IDebugLogger)
    self.add_default_response_adapters()
    self.add_default_renderers()
    self.add_default_view_predicates()
    self.add_default_view_derivers()
    self.add_default_route_predicates()
    self.add_default_tweens()
    self.add_default_security()
    if (exceptionresponse_view is not None):
        exceptionresponse_view = self.maybe_dotted(exceptionresponse_view)
        self.add_view(exceptionresponse_view, context=IExceptionResponse)
        self.add_view(exceptionresponse_view, context=WebobWSGIHTTPException)
    self.commit()
    if (authentication_policy and (not authorization_policy)):
        authorization_policy = ACLAuthorizationPolicy()
    if authorization_policy:
        self.set_authorization_policy(authorization_policy)
    if authentication_policy:
        self.set_authentication_policy(authentication_policy)
    if (default_view_mapper is not None):
        self.set_view_mapper(default_view_mapper)
    if renderers:
        for (name, renderer) in renderers:
            self.add_renderer(name, renderer)
    if (root_factory is not None):
        self.set_root_factory(root_factory)
    if locale_negotiator:
        self.set_locale_negotiator(locale_negotiator)
    if request_factory:
        self.set_request_factory(request_factory)
    if response_factory:
        self.set_response_factory(response_factory)
    if default_permission:
        self.set_default_permission(default_permission)
    if (session_factory is not None):
        self.set_session_factory(session_factory)
    tweens = aslist(registry.settings.get('pyramid.tweens', []))
    for factory in tweens:
        self._add_tween(factory, explicit=True)
    includes = aslist(registry.settings.get('pyramid.includes', []))
    for inc in includes:
        self.include(inc)
