﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24639	Interaction between ValidationError and mark_safe	jambonrose	jambonrose	"Succinctly: the `ValidationError` message only respects `mark_safe` if the `params` argument is not used.

Current behavior:

||= message =||= params =||=  output  =||
|| text      || none     || text       ||
|| safe      || none     || safe       ||
|| text      || text     || text       ||
|| safe      || text     || text       ||
|| text      || safe     || text       ||
|| safe      || safe     || '''text''' ||

Given that, according to the [https://docs.djangoproject.com/en/1.8/ref/forms/validation/#raising-validationerror documentation], the best way to use `ValidationError` is with the `params` argument, it seems desirable to enable using `mark_safe` when using `params`, as this would enable us to code:

{{{#!python
# method for a Form subclass
def clean_slug(self):
    new_slug = self.cleaned_data['slug'].lower()
    if new_slug == 'invalid_value':
        raise ValidationError(
            # _ is ugettext
            mark_safe(_('SlugField may not be '
                        '""%(slug_value)s"" '
                        'for URL reasons.')),
            params={
                'slug_value':
                    mark_safe('<code>invalid_value</code>')})
    return new_slug
}}}

I think desired behavior ought to be:

||= message =||= params =||=  output  =||
|| text      || none     || text       ||
|| safe      || none     || safe       ||
|| text      || text     || text       ||
|| safe      || text     || text       ||
|| text      || safe     || text       ||
|| safe      || safe     || '''safe''' ||
 
For more information about the issue, please see [https://groups.google.com/d/msgid/django-developers/4761844C-6BFE-465A-9108-AFDA693A9E06%40andrewsforge.com my message on django-developers]."	Bug	closed	Forms	1.8	Normal	wontfix			Accepted	1	0	0	0	0	0
