#12568: SubFieldBase descriptor object should be accessible
---------------------------------------+------------------------------------
Reporter: specialunderwear | Owner: nobody
Status: new | Milestone:
Component: Forms | Version: 1.2-alpha
Resolution: | Keywords: SubFieldBase
subclassing
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 1
Needs_better_patch: 0 |
---------------------------------------+------------------------------------
Comment (by specialunderwear):
I added a new patch + tests to fix this issue in 1.2
Please do not let descriptors break inspect, but instead behave like a
proper property, which returns self when a descriptor is accessed without
context:
http://users.rcn.com/python/download/Descriptor.htm#properties
If you need the descriptor object itself to be inaccessible for some
reason, just return None instead of self. This would also make more sense,
an uninitialized property is None, just like a regular attribute.
There are more places where the AttributeError is thrown, for instance
ManagerDescriptor raises:
AttributeError: Manager isn't accessible via MyModel instances
When a model instance is inspected.
ImageField and FileField also do it, which to me seems wrong.
--
Ticket URL: <http://code.djangoproject.com/ticket/12568#comment:5>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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-updates?hl=en.