Skip to content

DirectThingClient silently breaks when read-only properties are written to. #165

@rwb27

Description

@rwb27

Describe the bug
A DirectThingClient with a read-only property will allow it to be written to.

To Reproduce
Make a DirectThingClient with a read-only property. There's an example in test_settings.py in #155 .

Expected behaviour
An exception should be raised.

Probable fix
I think the descriptor used on DirectThingClient objects does not have a __set__ method if it's read-only. This means it changes from being a data descriptor into a non-data descriptor and the object's __dict__ takes precedence. That means the first time it's written to, we don't attempt to write to the wrapped Thing and instead we just use the DirectThingClient instance __dict__.

I believe this could be fixed by adding a __set__ method that raises an exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions