Opened 17 years ago
Closed 17 years ago
#7342 closed (fixed)
Using a new-style class for Meta raises an exception
| Reported by: | Marty Alchin | Owned by: | Marty Alchin |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
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.
Attachments (1)
Change History (3)
by , 17 years ago
| Attachment: | 7342-r7568.diff added |
|---|
comment:1 by , 17 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|
comment:2 by , 17 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Per Jacob, this patch simply ignores any attributes beginning with
_, future-proofing this considerably.