Projet

Général

Profil

0001-misc-add-custom-robots.txt-view-20263.patch

Frédéric Péters, 13 avril 2020 10:13

Télécharger (1,36 ko)

Voir les différences:

Subject: [PATCH] misc: add custom /robots.txt view (#20263)

 wcs/urls.py  | 1 +
 wcs/views.py | 7 +++++++
 2 files changed, 8 insertions(+)
wcs/urls.py
21 21
from . import api
22 22

  
23 23
urlpatterns = [
24
    url(r'^robots.txt$', views.robots_txt),
24 25
    url(r'^backoffice/', views.backoffice),
25 26

  
26 27
    url(r'^api/validate-condition$', api.validate_condition, name='api-validate-condition'),
wcs/views.py
15 15
# along with this program; if not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17
from quixote import get_publisher, get_request, get_response
18
from django.http import HttpResponse
18 19

  
19 20
from .qommon import template
20 21
from . import compat
......
42 43
        return context
43 44

  
44 45
backoffice = Backoffice.as_view()
46

  
47

  
48
def robots_txt(request, *args, **kwargs):
49
    return HttpResponse(
50
            get_publisher().get_site_option('robots_txt', 'variables') or '',
51
            content_type='text/plain')
45
-