def has_object_permission(self, request, view, obj):
        assert self.parent_model_cls is not None, (
            'Cannot apply %s directly. '
            'You must subclass it and override the `parent_model_cls` '
            'attribute.' % self.__class__.__name__)

        model_cls = self.parent_model_cls
        user = request.user

        # There's a weird case sometimes where the BrowsableAPIRenderer checks permissions
        # that it doesn't need to, and throws an exception.  We'll default to less permissions
        # here rather than more.
        try:
            if obj._meta.app_label != model_cls._meta.app_label:
                return False
        except __HOLE__:
            # This means the BrowsableRenderer is trying to check object permissions on one of our
            # permissions responses... which are just dicts, so it doesn't know what to do.  We'll
            # check the parent object instead.
            model_name = model_cls._meta.model_name
            # All of our parent views have a `get_<model_name>` method, so we'll grab that and use
            # it to get an object to check permissions on.
            get_parent_obj = getattr(view, 'get_%s' % model_name)
            if get_parent_obj:
                return self.has_object_permission(request, view, get_parent_obj())
            else:
                return False

        perms = self.get_required_object_permissions(request.method, model_cls)

        if not user.has_perms(perms, obj):
            # If the user does not have permissions we need to determine if
            # they have read permissions to see 403, or not, and simply see
            # a 404 response.

            if request.method in permissions.SAFE_METHODS:
                # Read permissions already checked and failed, no need
                # to make another lookup.
                raise permissions.Http404

            read_perms = self.get_required_object_permissions('GET', model_cls)
            if not user.has_perms(read_perms, obj):
                raise permissions.Http404

            # Has read permissions.
            return False

        return True
dataset/ETHPy150Open stackdio/stackdio/stackdio/core/permissions.py/StackdioParentObjectPermissions.has_object_permission