From 7b93925d0021d25f0578a46c4125e4d908023e5e Mon Sep 17 00:00:00 2001 From: Gregory Soutade Date: Sun, 5 Jun 2016 09:13:46 +0200 Subject: [PATCH] Some robots doesn't set referer when they try to add comment --- dynastie/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dynastie/views.py b/dynastie/views.py index d6e0500..6e4bdaf 100755 --- a/dynastie/views.py +++ b/dynastie/views.py @@ -802,7 +802,10 @@ def tinymcelist_edit(request, post_id): def add_comment(request, post_id, parent_id): from dynastie.generators import post - ref = request.META['HTTP_REFERER'] + if not 'HTTP_REFERER' in request.META: + ref = "/" + else: + ref = request.META['HTTP_REFERER'] # Anti robot !! if request.POST['email'] != '':