Opened 3 weeks ago

Closed 2 weeks ago

Last modified 2 weeks ago

#37116 closed Cleanup/optimization (fixed)

The doc mentions that a code in a validationerror is good but does not tell why

Reported by: Arthur Vuillard Owned by: Arthur Vuillard
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description


Change History (6)

comment:1 by Jacob Walls, 3 weeks ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization
Version: 6.0dev

Sure, that sounds good. My advice would be to weave it into the original text, like

  • docs/ref/forms/validation.txt

    diff --git a/docs/ref/forms/validation.txt b/docs/ref/forms/validation.txt
    index 5715d15fa7..31f74350f9 100644
    a b Raising ``ValidationError``  
    117117In order to make error messages flexible and easy to override, consider the
    118118following guidelines:
    119119
    120 * Provide a descriptive error ``code`` to the constructor::
     120* Provide a descriptive error ``code`` to allow programmatic use that will not
     121  vary with translations::
    121122
    122123      # Good
    123124      ValidationError(_("Invalid value"), code="invalid")

I'll reopen your pull request.

comment:2 by Arthur Vuillard, 3 weeks ago

Owner: set to Arthur Vuillard
Status: newassigned

comment:3 by Arthur Vuillard, 3 weeks ago

comment:4 by Jacob Walls, 2 weeks ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:5 by Jacob Walls <jacobtylerwalls@…>, 2 weeks ago

Resolution: fixed
Status: assignedclosed

In 9551424:

Fixed #37116 -- Explained why a code is useful in a ValidationError.

comment:6 by Jacob Walls <jacobtylerwalls@…>, 2 weeks ago

In f6f7aa0:

[6.1.x] Fixed #37116 -- Explained why a code is useful in a ValidationError.

Backport of 95514247d86ebe0a1582d1fa7a9ffc314ac514f4 from main.

Note: See TracTickets for help on using tickets.
Back to Top