#28269 closed Bug (fixed)
Fix Model._meta._property_names to work with attributes that raise AttributeError
Reported by: | Adam Johnson | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.11 |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
As reported on the mailing list at https://groups.google.com/forum/#!msg/django-developers/ClQ0mCJ-a6Y/FOYTz98yBgAJ , the optimization I did in model init in commit d2a26c1a90e837777dabdf3d67ceec4d2a70fb86 did not copy in a try/except AttributeError. This fails because some third party apps install "class only" descriptors that raise AttributeError when not accessed in an instance, for example: https://github.com/kmmbvnr/django-fsm/blob/2d2eaee/django_fsm/__init__.py#L225
_property_names should be changed to try/except AttributeError when accessing the attributes on the class, and we should add a test to prevent regression.
Change History (6)
comment:1 by , 7 years ago
Summary: | Fix Model._meta._property_names to work with attributes raise AttributeError → Fix Model._meta._property_names to work with attributes that raise AttributeError |
---|
comment:2 by , 7 years ago
Severity: | Normal → Release blocker |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 7 years ago
comment:4 by , 7 years ago
Has patch: | set |
---|
PR