On 9/11/07, Amit Upadhyay <[EMAIL PROTECTED]> wrote:
>
> About validate_exception, this is the signature of the corresponding
> method in unittest:
>
> *assertRaises*( exception, callable, *args, **kw)
> they have removed message, but since args and kw will be passed to
> callable, these are the only two possible options for adding message:
>
> validate_raises(exception, msg, callable, *args, **kw) or
> validate_raises(msg, exception, callable, *args, **kw). I picked the former,
> and do not understand how it has become completely unreadable.
>

I suppose that's my fault. Every time I've seen assertRaises used, it was
used with a curried function, rather than supplying arguments directly to
it. I hadn't looked at the signature of it myself, so I was unaware that you
were in fact following convention on that particular point.

It's not terribly Pythonic, but people use it because it works well.
>
>
> This is my point, a set of convenience function, well thought out, will be
> used by python programmer no matter even if it is as bad as looking like
> coming from java. The challenge is probably to figure out function names and
> signatures that are intuitive as best as we can.
>

But when I say it "works well", I mean that it has a variety of other
features that are useful to Python programmers, and those work well enough
to not be reinvented. Doing something that looks terrible simply because "it
works" or "people will use it anyway" is definitely not the Python Way.
Personally, I think you're making a mountain of a mole hill here. There's
potential value, sure, but I just don't think it's worth it in the end,
after you consider the readability concerns. It just doesn't seem to be
enough benefit to make it worth the hassles.

Support of server side form validation is a strong point for django, and a
> rich libraries of such functions would only make things better. Batteries
> included thing. I have created a wiki page[1] with proposed function names
> and signatures, please go through it, and see if they make sense, and might
> be useful for django.
>
> [1]: http://code.djangoproject.com/wiki/ValidationHelperFunctionsProposal


What I'd recommend is that you make a mix-in class that you can use with
your forms, and validate them using your helper functions. Once you get them
worked out as well as you'd like, put it up on djangosnippets, and see what
kind of response you get. I could be wrong, but I don't expect you'll get
quite the "OMG This saved my life!" response you might (or might not) be
expecting.

-Gul

--~--~---------~--~----~------------~-------~--~----~
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