-def revision(request, slug, chunk=None):
- try:
- doc = Chunk.get(slug, chunk)
- except (Chunk.MultipleObjectsReturned, Chunk.DoesNotExist):
- raise Http404
+def revision(request, chunk_id):
+ doc = get_object_or_404(Chunk, pk=chunk_id)
+ if not doc.book.accessible(request):
+ return HttpResponseForbidden("Not authorized.")