Opened 10 years ago

Closed 9 years ago

#2535 closed defect (invalid)

[patch] Manipulator-aware admin validators are impossible

Reported by: Tom Tobin <korpios@…> Owned by: Adrian Holovaty
Component: Validators Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Since magic-removal was merged, there has been no straightforward way to create a validator with the manipulator available to it (see this post on django-users for an example of how it might be done). Furthermore, it has been outright impossible to create such a validator for use in the admin; such validators were possible in pre-MR by prefixing the validator name with manipulator_validate.

The attached patch aims to restore such functionality by means of a simple, backwards-compatible API change: if the validator takes three arguments, rather than the standard two (i.e., field_data and all_data), the manipulator will be passed in as the first argument. The patch uses currying to accomplish this, and accounts for all the various types of callables that might be used (methods, callable class instances, etc.).

Attachments (1)

manipulator_validators.diff (1.5 KB) - added by Tom Tobin <korpios@…> 10 years ago.
Implements manipulator-aware validators in post-MR.

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by Tom Tobin <korpios@…>

Attachment: manipulator_validators.diff added

Implements manipulator-aware validators in post-MR.

comment:1 Changed 10 years ago by Malcolm Tredinnick

priority: normallow

Decreasing the priority on this one for now. Since the Great Manipulator Redesign project seems to be gathering steam again on the developers' list, this patch should be unnecessary.

comment:2 Changed 9 years ago by korpios

Reporter: changed from Tom Tobin <korpios@…> to Tom Tobin <korpios@…>

comment:3 Changed 9 years ago by Adrian Holovaty

Resolution: invalid
Status: newclosed

Closing this because manipulators have been replaced with the newforms library.

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