Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #6
0
 def __delete__(self, inst):
     # CPython can hit this, PyPy/PURE_PYTHON cannot
     inst = getProxiedObject(inst)
     del inst.__provides__
Exemple #7
0
 def __set__(self, inst, value):
     inst = getProxiedObject(inst)
     inst.__provides__ = value
Exemple #8
0
 def __delete__(self, inst):
     # CPython can hit this, PyPy/PURE_PYTHON cannot
     inst = getProxiedObject(inst)
     del inst.__provides__
Exemple #9
0
 def __set__(self, inst, value):
     inst = getProxiedObject(inst)
     inst.__provides__ = value