On 3/13/06, Christopher Lenz <[EMAIL PROTECTED]> wrote: > > Am 13.03.2006 um 08:00 schrieb Adrian Holovaty: > [snip] > > Thoughts, criticisms? The only part I'm sketchy on is the side effect > > of converting the values to their Python data types. The > > cleanliness/consistency is quite nice, but it's slightly not something > > a developer might expect. However, we can solve the latter through > > clear documentation. > > IMHO automatic conversion from strings to python types shouldn't be > in the model layer. Model fields should expect to get a compatible > type (at least directly castable to the target type, such as int > (floatnum) or str(intnum)). I could even imagine a DateTimeField > accepting a timestamp or time tuple... but parsing out the date from > a string seems like a step too far. The form/manipulator should be > doing that kind of conversion.
My gut reaction is that type conversion is controller level behavior, it has nothing to do with "business logic" and everything to do with the fact that we're getting this data from the web. It belongs in a web controller layer, FormField seems like the obvious candidate. However, when I try to dream up a use case where someone would *really* set a date field to a sting, or an int field to a sting, and expect a string back... well... Can anyone come up with an actual practical use case? I suppose this is more about expected behavior than actual usage as a feature though. Joseph --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
