On 8/11/06, Tom Tobin <[EMAIL PROTECTED]> wrote:
> On 8/9/06, Tom Tobin <[EMAIL PROTECTED]> wrote:
> > I'd like to restore this ability to Django trunk; there are a couple
> > of ways I could go about this, and I'd like input as to which would be
> > cleaner:
>
> I came up with a third possible way of handling this (which is nearly
> identical to the second): instead of wrapping validators that have a
> ``takes_manipulator`` attribute, would there be an issue with
> introspecting for the number of arguments to a validator, and wrapping
> if there are three (or, for a method, four)?

Replying to myself once again . . . :-p

I've created ticket #2535, which has an attached patch for
implementing my proposal using currying and introspection for the
number of arguments.  With the patch applied, giving the validator
access to the manipulator is as easy as adding an extra parameter::

    def my_validator(manipulator, field_data, all_data):
        model = manipulator.model
        if manipulator.change:
            original_object = manipulator.original_object
        # . . . do stuff . . .

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to