Exemplo n.º 1
0
    def __get__(self, inst, cls=None):
        if inst is None: # pragma: no cover (Not sure how we can get here)
            return getObjectSpecification(cls)

        provided = providedBy(getProxiedObject(inst))

        # Use type rather than __class__ because inst is a proxy and
        # will return the proxied object's class.
        cls = type(inst)
        return ObjectSpecification(provided, cls)
Exemplo n.º 2
0
    def __get__(self, inst, cls=None):
        if inst is None:  # pragma: no cover (Not sure how we can get here)
            return getObjectSpecification(cls)

        provided = providedBy(getProxiedObject(inst))

        # Use type rather than __class__ because inst is a proxy and
        # will return the proxied object's class.
        cls = type(inst)
        return ObjectSpecification(provided, cls)
Exemplo n.º 3
0
    def __get__(self, inst, cls=None):
        if inst is None:  # pragma: no cover (Not sure how we can get here)
            return self

        proxied_object = getProxiedObject(inst)
        checker = getattr(proxied_object, '__Security_checker__', None)
        if checker is None:
            checker = selectChecker(proxied_object)
        wrapper_checker = selectChecker(inst)
        if wrapper_checker is None:  # pragma: no cover
            return checker
        if checker is None:
            return wrapper_checker
        return CombinedChecker(wrapper_checker, checker)
Exemplo n.º 4
0
    def __get__(self, inst, cls=None):
        if inst is None:  # pragma: no cover (Not sure how we can get here)
            return getObjectSpecification(cls)

        provided = providedBy(getProxiedObject(inst))

        # Use type rather than __class__ because inst is a proxy and
        # will return the proxied object's class.
        cls = type(inst)
        implemented_by_cls = implementedBy(cls)
        for iface in list(provided):
            if implemented_by_cls.isOrExtends(iface):
                provided = provided - iface
        return Provides(cls, provided)
Exemplo n.º 5
0
    def __get__(self, inst, cls=None):
        if inst is None: # pragma: no cover (Not sure how we can get here)
            return self

        proxied_object = getProxiedObject(inst)
        checker = getattr(proxied_object, '__Security_checker__', None)
        if checker is None:
            checker = selectChecker(proxied_object)
        wrapper_checker = selectChecker(inst)
        if wrapper_checker is None: # pragma: no cover
            return checker
        if checker is None:
            return wrapper_checker
        return CombinedChecker(wrapper_checker, checker)
Exemplo n.º 6
0
 def __delete__(self, inst):
     # CPython can hit this, PyPy/PURE_PYTHON cannot
     inst = getProxiedObject(inst)
     del inst.__provides__
Exemplo n.º 7
0
 def __set__(self, inst, value):
     inst = getProxiedObject(inst)
     inst.__provides__ = value
Exemplo n.º 8
0
 def __delete__(self, inst):
     # CPython can hit this, PyPy/PURE_PYTHON cannot
     inst = getProxiedObject(inst)
     del inst.__provides__
Exemplo n.º 9
0
 def __set__(self, inst, value):
     inst = getProxiedObject(inst)
     inst.__provides__ = value