My favorites | Sign in
Project Logo
             
New issue | Search
for
| Advanced search | Search tips
Issue 9: allow errors from constraints with others() to refer to named fields in the error message
1 person starred this issue and may be notified of changes. Back to list
Status:  Accepted
Owner:  fireartist
Type-Enhancement
Priority-Medium


Sign in to add a comment
 
Reported by fireartist, May 02, 2007
Example

constraint:
  - type: AllOrNone
    name: foo
    others: [bar, baz]

Would like the error message to be able to change depending on whether it's
the bar or baz or both fields that were missing.
Would like the error message to be able to refer to the fields label or
other 'friendly' name, rather than the field's name attribute.

Suspect the only satisfactory was of dealing with this might be to allow
providing a code-ref to generate the error message.

Comment 1 by mjh-goo...@liminalflux.net, Aug 17, 2008
If there's a solution, can it be generalised to all the constraints properties?

Eg:
         - type: Length
            min: 2
            max: 50
            message: Must be at least 2 and no more than 50 characters long

It would be nice not to have to change the error message because the constraint 
limits changed.
Sign in to add a comment

Hosted by Google Code