def patch_is_closed(request, thread, value): if thread.acl.get('can_close'): if value: moderation.close_thread(request, thread) else: moderation.open_thread(request, thread) return {'is_closed': thread.is_closed} else: if value: raise PermissionDenied(_("You don't have permission to close this thread.")) else: raise PermissionDenied(_("You don't have permission to open this thread."))