confirmation = property(_get_confirmation, _set_confirmation) confirmation.short_description = 'Confirmation'
When I try the above I get an Exception I don’t quite understand:
AttributeError: 'property' object has no attribute 'short_description'
This was an answer to another question on here but I couldn’t comment on it as I don’t have enough points or something. 🙁
In other tests I’ve also got this error under similar circumstances:
TypeError: 'property' object has only read-only attributes (assign to .short_description)
Any ideas anybody?
The result of property() is an object where you can’t add new fields or methods. It’s immutable which is why you get the error.
One way to achieve what you want is with using four arguments to
property():or put the explanation into the docstring of
_get_confirmation.(see docs here, also supported in Python 2)
[EDIT] As for the answer, you refer to: I think the indentation of the example was completely wrong when you looked at it. This has been fixed, now.