Honza Král wrote:
> On 12/18/06, Gary Wilson <[EMAIL PROTECTED]> wrote:
> >
> > Honza Král wrote:
> > > On 12/17/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote:
> > >  Feel free to take
> > > > on any of the items mentioned in this e-mail, as long as we've all
> > > > agreed on the right way to solve the problems. Rewriting the
> > > > validators to Fields would be a much-welcomed contribution, too.
> > > > Whatever you choose, let us know so that we don't duplicate work.
> > >
> > > see new_fields.py for validators transformed into Fields. It is a
> > > result of a few sed expressions (see gen_new_fields.sh ) and some
> > > manual tweaks. I haven't tested it even for syntax errors, any help
> > > would be welcome, especially tests and documentation (I suck at
> > > these)...
> > >
> > > I will continue working on those whenever I have some time (and mood ;) )
> >
> > If inheriting Fields is going to be the new validator_list, don't we
> > need to add some super() calls in those clean() methods?
> >
>
> there are - every clean() starts with
> value = ParentField.clean( value )
> which should represent a super call

But it's not the same thing. Let's say I want to make a
LowerCaseAlphaNumericField that inherits LowerCaseField and
AlphaNumericField, both of which inherit CharField.  If I were to call
LowerCaseField.clean() and AlphaNumericField.clean() from my
LowerCaseAlphaNumericField.clean(), then CharField.clean() and
Field.clean() would both get called twice.  If I were to use a super
call in my LowerCaseAlphaNumericField.clean(), then
LowerCaseField.clean(), CharField.clean(), and Field.clean() would get
called, but not AlphaNumericField.clean().

Everybody must use super so that all the correct methods get called and
get called only once.

I'm not sure where ComboField fits into this either.  Is ComboField
supposed to be used instead of inheritance for building validators?  If
so, then ComboField suffers the same fate of calling clean() methods of
inherited Fields more than once (even if super calls are used) because
ComboField.clean() simply calls every passed Field's clean() method.


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

Reply via email to