Opened 17 years ago

Closed 17 years ago

#3250 closed enhancement (wontfix)

[patch] Add RequiredIfOtherFieldsNotGiven, RequiredIfAllOtherFieldsNotGiven, and AllValidators

Reported by: exogen@… Owned by: Adrian Holovaty
Component: Validators 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

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@… 17 years ago.
adds validators mentioned in #3250
brian_tests.py (2.0 KB ) - added by exogen@… 17 years ago.
doctests for validators added in #3250

Download all attachments as: .zip

Change History (7)

by exogen@…, 17 years ago

Attachment: brian_validators.diff added

adds validators mentioned in #3250

by exogen@…, 17 years ago

Attachment: brian_tests.py added

doctests for validators added in #3250

comment:1 by Matt, 17 years ago

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 by Simon G. <dev@…>, 17 years ago

Triage Stage: UnreviewedReady for checkin

My thoughts:

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

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

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 by James Bennett, 17 years ago

Hmm.

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

comment:5 by Malcolm Tredinnick, 17 years ago

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