Better error for read-only properties

Previously, the Admin API caller would bet a misleading error message
indicating that the property did not exist.
This commit is contained in:
Demi Marie Obenour 2021-02-17 22:43:43 -05:00 committed by Demi Marie Obenour
parent b7b6d1907c
commit 93b8c34053
No known key found for this signature in database
GPG Key ID: 28A45C93B0B5B6E0

View File

@ -409,11 +409,12 @@ class property: # pylint: disable=redefined-builtin,invalid-name
This is used to effectively disable property in classes which inherit This is used to effectively disable property in classes which inherit
unwanted property. When someone attempts to load such a property, it unwanted property. When someone attempts to load such a property, it
:throws AttributeError: always :throws qubes.exc.QubesPropertyValueError: always
''' # pylint: disable=bad-staticmethod-argument,unused-argument ''' # pylint: disable=bad-staticmethod-argument,unused-argument
raise AttributeError( raise qubes.exc.QubesPropertyValueError(
'setting {} property on {} instance is forbidden'.format( self, self.property_get_def(prop), value,
'property {!r} on {} instance cannot be set'.format(
prop.__name__, self.__class__.__name__)) prop.__name__, self.__class__.__name__))