Skip to content

Commit 3e16da6

Browse files
committed
Fixed an issue that could prevent error messages from docutils from propagating to the end user when editing RST templates.
- Legacy-Id: 18416
1 parent 4b937c9 commit 3e16da6

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

ietf/dbtemplate/template.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from django.template import Origin, TemplateDoesNotExist, Template as DjangoTemplate
1212
from django.template.loaders.base import Loader as BaseLoader
13+
from django.utils.safestring import mark_safe
1314

1415
from ietf.dbtemplate.models import DBTemplate
1516

@@ -53,9 +54,9 @@ def render(self, context):
5354
'halt_level': 2,
5455
})
5556
except SystemMessage as e:
56-
e.message = e.message.replace('<string>:', 'line ')
57+
e.message = mark_safe('<div class="danger preformatted">%s</div>' % str(e).replace('<string>:', 'line '))
5758
args = list(e.args)
58-
args[0] = args[0].replace('<string>:', 'line ')
59+
args[0] = mark_safe('<div class="danger preformatted">%s</div>' % args[0].replace('<string>:', 'line '))
5960
e.args = tuple(args)
6061
raise e
6162

ietf/templates/nomcom/edit_template.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ <h2>Template: {{ template }}</h2>
3232
</dl>
3333

3434
<form id="templateform" method="post">
35+
{% if form.errors %}
36+
<p class="alert alert-danger">There were errors, see below.</p>
37+
{% endif %}
3538
{% csrf_token %}
3639
{% bootstrap_form form %}
3740

0 commit comments

Comments
 (0)