book = get_object_or_404(Book, slug=slug)
if not book.accessible(request):
return HttpResponseForbidden("Not authorized.")
try:
protocol = 'https://' if request.is_secure() else 'http://'
book = get_object_or_404(Book, slug=slug)
if not book.accessible(request):
return HttpResponseForbidden("Not authorized.")
try:
protocol = 'https://' if request.is_secure() else 'http://'