On Mon, 2007-09-17 at 07:15 +0000, SmileyChris wrote: > In regards to http://code.djangoproject.com/ticket/5050, Malcolm said: > > This needs some django-dev discussion.[...] > > I also feel a bit suspicious about the design. Both Form and > BaseForm end up with the same root metaclass (because > DeclarativeFieldsMetaclass inherits from BaseFieldsMetaclass). I don't > have a concrete reason why I don't like that yet, but it smells funny. > > I'm not sure why this smells so funny to you. They both need to be > able to inherit base_fields, so why shouldn't they have the same root > metaclass? All Form does is do some magic on the top, so that bit of > magic has been separated out to a subclass of the BaseFieldsMetaclass
I think my uncomfortableness was actually brought on by the way Python processes metaclasses. It doesn't call the metaclass for base classes, so we're not processing it twice. Objection withdrawn. > Here's another bug (I believe) it should solve > http://code.djangoproject.com/ticket/4239. The patch on that ticket seems like a cleaner way to solve the problem mentioned there. Again, some messiness here because __metaclass__ is only processed for the bottom-most class in the hierarchy. It might also be solved by your patch, but I feel that's more an en passant artifact than a better way to solve #4239. > > I can appreciate that mixins to introduce common fields would be > nice, but the implementation is fiddly. If the goal is to shoehorn > more tricks into form_for_*, I'm going to be a hard sell. > > Granted, my choice of a test wasn't best. I'm -0 on idea because I think people are using form_for_* too much as a crutch instead of just writing a few lines of code. Making it more and more complicated internally isn't helping them to write code that isn't disguised behind a factory function on steroids or us, as the people who have to maintain the ever-growing number of edge case. I'm feeling this is "because we can", rather than a "because we need to" change right at the moment. You need a more convincing use-case. Malcolm -- Experience is something you don't get until just after you need it. http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
