

def __call__(self, obj, request):
    'Render a model instance.\n\n        If view is internal it cannot be rendered.\n\n        If the identity does not have the permission for\n        this object according to the permission rules then\n        :class:`webob.exc.HTTPForbidden` is raised.\n\n        Any functions specified using :meth:`morepath.Request.after`\n        are run against the response once it is created, if that\n        response is not an error.\n\n        :param obj: the model instance\n        :param request: the request\n        :return: A :class:`webob.response.Response` instance.\n        '
    if self.internal:
        raise HTTPNotFound()
    if ((self.permission is not None) and (not generic.permits(request.identity, obj, self.permission, lookup=request.lookup))):
        raise HTTPForbidden()
    content = self.func(obj, request)
    if isinstance(content, BaseResponse):
        response = content
    else:
        response = self.render(content, request)
    if (200 <= response.status_code <= 399):
        request.run_after(response)
    return response

dataset/ETHPy150Open morepath/morepath/morepath/view.py View.__call__/original