I normally hate to "ping" discussions on mailing lists, but two weeks have passed, and I was hoping I could get an answer to the biggest question facing this discussion. Adrian, could you clarify what you meant by "loaded into memory" means exactly, in this context? Are you referring to loading the code as part of a module, regardless of whether it gets executed? Or is it about executing the code and the memory overhead associated with that?
Getting an answer to this is key to asking additional questions about the best way to approach validation of Field subclasses. I have a workaround for pluggable FileField backends, which is what originally started this discussion, but it'd be good to have this clarified so that other subclasses can know how best to approach validation. -Gul On 8/20/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > On 8/20/07, Marty Alchin <[EMAIL PROTECTED]> wrote: > > Is there a particular reason this validation is being performed there > > instead of in the __init__ of each Field subclass? I haven't looked > > over the entirety of it, but it seems like that's going to be > > something of a barrier to custom subclasses, if those subclasses > > redefine any of those assumptions. > > There is indeed a reason: model field validation logic is in a > separate module so that the logic doesn't have to be loaded into > memory when you're using Django in production. As it stands, the > validation code is only loaded when you use one of the relevant > manage.py commands. Validation really only matters when you're > developing. > > (By the way, this "don't load it into memory unless you need it" > reasoning applies to a lot of the other stuff in > django/core/management, like the code that makes "CREATE TABLE" > statements, etc.) > > We *could* have our cake and eat it too, by adding a validate() method > hook to the database Field class and have the default implementation > import the full validation logic from another module. This would let > people implement their own validation logic for custom fields. > > Adrian > > -- > Adrian Holovaty > holovaty.com | djangoproject.com > > > > --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---