Esempio n. 1
0
    as the default when ``ZOPE_WATCH_CHECKERS`` is set when this
    module is imported.
    """
    verbosity = WATCH_CHECKERS

if WATCH_CHECKERS: # pragma: no cover
    # When we make these the default, we also need to be sure
    # to update the _defaultChecker's type (if it's not the C
    # extension) so that selectCheckerPy can properly recognize
    # it as a Checker.
    # See https://github.com/zopefoundation/zope.security/issues/8
    Checker = WatchingChecker
    CombinedChecker = WatchingCombinedChecker

    if not _c_available:
        _defaultChecker.__class__ = Checker

def _instanceChecker(inst):
    return _checkers.get(inst.__class__, _defaultChecker)

def moduleChecker(module):
    """
    Return the :class:`zope.security.interfaces.IChecker` defined for the
    *module*, if any.

    .. seealso:: :func:`zope.security.metaconfigure.protectModule`
       To define module protections.
    """
    return _checkers.get(module)