Opened 10 years ago

Closed 10 years ago

#3250 closed enhancement (wontfix)

[patch] Add RequiredIfOtherFieldsNotGiven, RequiredIfAllOtherFieldsNotGiven, and AllValidators

Reported by: exogen@… Owned by: Adrian Holovaty
Component: Validators Version: master
Severity: normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

In the Validators documentation there claims to be a RequiredIfOtherFieldsNotGiven, but it doesn't actually exist. This implements the documented semantics and also introduces two supporting validators.

RequiredIfAllOtherFieldsNotGiven: Like the one mentioned above, but fails only when all of the other fields are not given (instead of any).
AllValidators: Like AnyValidator, but passes only when all of the given validators pass.

Attachments (2)

brian_validators.diff (2.5 KB) - added by exogen@… 10 years ago.
adds validators mentioned in #3250
brian_tests.py (2.0 KB) - added by exogen@… 10 years ago.
doctests for validators added in #3250

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by exogen@…

Attachment: brian_validators.diff added

adds validators mentioned in #3250

Changed 10 years ago by exogen@…

Attachment: brian_tests.py added

doctests for validators added in #3250

comment:1 Changed 10 years ago by Matt

The patch attached here overlaps with the patch on ticket #2266.

The patch on ticket #2266 adds RequiredIfOtherFieldsNotGiven (with tests and updated docs) while this ticket offers RequiredIfOtherFieldsNotGiven and a new RequiredIfAllOtherFieldsNotGiven validators with tests but no docs.

Should we merge the tickets and flag one as a duplicate?

comment:2 Changed 10 years ago by Simon G. <dev@…>

Triage Stage: UnreviewedReady for checkin

My thoughts:

  • take the RequiredIfOtherFieldsNotGiven from #2266
  • take the RequiredIfOtherFieldsNotGiven and RequiredIfAllOtherFieldsNotGiven from here.

comment:3 in reply to:  2 Changed 10 years ago by David Chandek-Stark <david.chandek.stark@…>

Replying to Simon G. <dev@simon.net.nz>:

My thoughts:

  • take the RequiredIfOtherFieldsNotGiven from #2266
  • take the RequiredIfOtherFieldsNotGiven and RequiredIfAllOtherFieldsNotGiven from here.

Did you mean "take AllValidators and RequiredIfAllOtherFieldsNotGiven from here"?

In any case, I'd love to see these patches released soon.

Thanks!

comment:4 Changed 10 years ago by James Bennett

Hmm.

Might be tough to justify adding more functionality to the manipulator system just as we're deprecating it...

comment:5 Changed 10 years ago by Malcolm Tredinnick

Resolution: wontfix
Status: newclosed

Since the validator functions primarily exist to support the oldforms part of the framework, we aren't adding any extra functionality to it now. It's deprecated. The fact that validators can also be used in model fields is kind of a side-effect and some model-aware validation changes will slowly phase that out, too.

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