X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/33f38948f6f42804f6baf7e431bb9a143daf0884..53e53be2fd5c6ffd0b96928735944aa75b7b2f2d:/src/catalogue/views.py?ds=inline diff --git a/src/catalogue/views.py b/src/catalogue/views.py index bba773d32..5273ab429 100644 --- a/src/catalogue/views.py +++ b/src/catalogue/views.py @@ -6,6 +6,7 @@ from collections import OrderedDict import random from django.conf import settings +from django.http.response import HttpResponseForbidden from django.template import RequestContext from django.template.loader import render_to_string from django.shortcuts import render_to_response, get_object_or_404, render, redirect @@ -27,6 +28,7 @@ from catalogue.helpers import get_top_level_related_tags from catalogue.models import Book, Collection, Tag, Fragment from catalogue.utils import split_tags from catalogue.models.tag import prefetch_relations +from wolnelektury.utils import is_crawler staff_required = user_passes_test(lambda user: user.is_staff) @@ -222,6 +224,9 @@ def tagged_object_list(request, tags, list_type): except ResponseInstead as e: return e.response + if is_crawler(request) and len(tags) > 1: + return HttpResponseForbidden('address removed from crawling. check robots.txt') + if list_type == 'gallery' and any(tag.category == 'set' for tag in tags): raise Http404