예제 #1
0
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)
예제 #2
0
def _instanceChecker(inst):
    return _checkers.get(inst.__class__, _defaultChecker)
예제 #3
0
                                   'quantize', 'remainder_near',
                                   'same_quantum', 'sqrt',
                                   'to_eng_string', 'to_integral' ]),

    # YAGNI: () a rock
    tuple: NamesChecker(['__getitem__', '__getslice__', '__add__', '__radd__',
                         '__contains__', '__len__', '__iter__',
                         '__str__']),
    Proxy: NoProxy,
    type(weakref.ref(_Sequence())): NamesChecker(['__call__']),
    types.FunctionType: _callableChecker,
    types.MethodType: _callableChecker,
    types.BuiltinFunctionType: _callableChecker,
    types.BuiltinMethodType: _callableChecker,
    type: _typeChecker,
    types.ModuleType: lambda module: _checkers.get(module, _namedChecker),
    type(iter([])): _iteratorChecker, # Same types in Python 2.2.1,
    type(iter(())): _iteratorChecker, # different in Python 2.3.
    type(iter({})): _iteratorChecker,
    type(iter(set())): _iteratorChecker,
    type(iter(_Sequence())): _iteratorChecker,
    type(f()): _iteratorChecker,
    type(Interface): InterfaceChecker(
        IInterface,
        __str__=CheckerPublic, _implied=CheckerPublic, subscribe=CheckerPublic,
        ),
    zope.interface.interface.Method: InterfaceChecker(
        zope.interface.interfaces.IMethod),
    zope.interface.declarations.ProvidesClass: _Declaration_checker,
    zope.interface.declarations.ClassProvides: _Declaration_checker,
    zope.interface.declarations.Implements: _Declaration_checker,
예제 #4
0
파일: checker.py 프로젝트: c0ns0le/zenoss-4
def moduleChecker(module):
    return _checkers.get(module)
예제 #5
0
파일: checker.py 프로젝트: c0ns0le/zenoss-4
 types.ClassType:
 _typeChecker,
 types.FunctionType:
 _callableChecker,
 types.MethodType:
 _callableChecker,
 types.BuiltinFunctionType:
 _callableChecker,
 types.BuiltinMethodType:
 _callableChecker,
 type(().__getslice__):
 _callableChecker,  # slot description
 type:
 _typeChecker,
 types.ModuleType:
 lambda module: _checkers.get(module, _namedChecker),
 type(iter([])):
 _iteratorChecker,  # Same types in Python 2.2.1,
 type(iter(())):
 _iteratorChecker,  # different in Python 2.3.
 type(iter({})):
 _iteratorChecker,
 type(iter(set())):
 _iteratorChecker,
 type({}.iteritems()):
 _iteratorChecker,
 type({}.iterkeys()):
 _iteratorChecker,
 type({}.itervalues()):
 _iteratorChecker,
 type(iter(_Sequence())):
예제 #6
0
def moduleChecker(module):
    return _checkers.get(module)