On 9/9/07, Amit Upadhyay <[EMAIL PROTECTED]> wrote: > Drawback if most of the times we are not using that feature, each validation > statement will have to contain a superfluous self. in the beginning. Whereas > helper functions can all be imported in the name space. Its only minor > syntactic sugar so to say, that we are after with this.
Well, if you don't like calling self.XXX, then maybe Python isn't the language for you :-) Seriously, I don't see the problem. The validation functions will be fairly tightly bound to a particular form, and to that form's cleaned_data. 'self.' is the way Python binds a method to an instance. The only way you could avoid calling 'self.validate_XXX' is to provide the form (or pieces of the form) as arguments to a generic function: i.e., validate(self, 'field1','field2'), or validate(self.cleaned_data['field1'], self.cleaned_data['field2']), both of which I find much less elegant. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
