> Nathan, perhaps you can post a short excerpt of your code?
>
> Closures are lovely and all, but newforms needs a few minor but
> important design changes so it doesn't require us to do anything even
> slightly hackish. It's close, but no cigar - yet.

I'd be happy to, however if you feel that closures are hackish I doubt
it'll do much for you.

I was in need of a form with a dynamic number of form fields.
Originally I created a `_clean_helper(field)` method and then created
two independent helper methods that ultimately returned a lambda
assigned to clean_FIELDNAME attributes. Now that I'm learning about
closures, I was able to replace all that by nesting my main helper
method in a closure that looks pretty much exactly like Vsevolod's
example.

I'm indifferent about having to use closures instead of passing
`field` to the `clean_*` methods. I don't feel it is more of an
inconvenience than other non-standard newform usages such as
overriding `__init__()`. That having been said, closures and
inheritance should be represented in the Django documentation in
deference to the hordes of unwashed PHP refugees. Being one of them,
it took me nearly as long to learn newforms as it did for me to learn
Django itself.

- whiteinge


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