#37116: The doc mentions that a code in a validationerror is good but does not tell
why
--------------------------------------+------------------------------------
Reporter: Arthur Vuillard | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Jacob Walls):
* needs_better_patch: 0 => 1
* stage: Unreviewed => Accepted
* type: Uncategorized => Cleanup/optimization
* version: 6.0 => dev
Comment:
Sure, that sounds good. My advice would be to weave it into the original
text, like
{{{#!diff
diff --git a/docs/ref/forms/validation.txt b/docs/ref/forms/validation.txt
index 5715d15fa7..31f74350f9 100644
--- a/docs/ref/forms/validation.txt
+++ b/docs/ref/forms/validation.txt
@@ -117,7 +117,8 @@ Raising ``ValidationError``
In order to make error messages flexible and easy to override, consider
the
following guidelines:
-* Provide a descriptive error ``code`` to the constructor::
+* Provide a descriptive error ``code`` to allow programmatic use that
will not
+ vary with translations::
# Good
ValidationError(_("Invalid value"), code="invalid")
}}}
I'll reopen your pull request.
--
Ticket URL: <
https://code.djangoproject.com/ticket/37116#comment:1>