Maniac wrote:
> I think it shouldn't be magical here because user shouldn't use this
> often at all. I think automatisation of converting a form to an object
> should happen a level higher like this:
>
>     c = Crime.parse_form_data(request.POST)
>
> parse_form_data would iterate over field objects and try to set them
> using their own convertion methods:
>
>     field=field.from_str(request.POST.get(field.name,''))
>
> I beleive that cases when you need to set fields explicitely are rarely
> related to handling form input where all values are strings.
>
> >If an attribute is going to be magic it should be consistently magic.
> >
> >
> I completely agree with consistency. But I still think that attributes
> should be magical.

Yes, perhaps better to avoid the magic altogether by having a class
method specifically for converting from string data. Perhaps something
like:

c = Crime.from_strings(request.POST)

would be clearer and more general than parse_form_data?

Kieran


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