Using a new-style class for Meta raises an exception
|Reported by:||Marty Alchin||Owned by:||Marty Alchin|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
When attempting to use a new-style class for a model's
Meta inner class (
class Meta(object):), Django raises a
TypeError because of two additional attributes that new-style classes have that old-style classes don't.
TypeError: 'class Meta' got invalid attribute(s): __dict__,__weakref__
Admittedly, the documentation only shows old-style classes, but there's no mention of avoiding new-style classes. More to the point, once Python 3000 rolls around, all classes will be new-style by default, and this will become an instant problem.