From f318edb433026cd863c93bc2433522e8a2d7a659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20Caux?= <git@jscaux.org> Date: Mon, 11 Apr 2022 17:34:03 +0200 Subject: [PATCH] Make automarkup robust to non-template calls --- scipost_django/markup/templatetags/automarkup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scipost_django/markup/templatetags/automarkup.py b/scipost_django/markup/templatetags/automarkup.py index db4c713e2..1345b1b0b 100644 --- a/scipost_django/markup/templatetags/automarkup.py +++ b/scipost_django/markup/templatetags/automarkup.py @@ -16,7 +16,7 @@ register = template.Library() @register.simple_tag(takes_context=True) def automarkup(context, text, language_forced=None): markup = process_markup(text, language_forced=language_forced) - if markup["errors"] and context["request"]: + if markup["errors"] and "request" in context and context["request"]: # Create a ticket (if not yet present) flagging the error for page's # url if automarkup called in template (so if context.request exists) markup_queue = Queue.objects.get(name="Markup") -- GitLab