Skip to content

no way to prevent state_set from removes existing attributes #9

Closed
@fleXible

Description

@fleXible

Hi,

using state.set("domain.entity", "new state") removes existing attributes. It is possible to supply an attribute dict, but there was no way of collecting all existing attributes from a state. state.get() only supported pulling a single attribute by name.

Also state_get() would not return the full State object, but only the state as string or the attribute value.

As a possible way to fix this, I did some changes:

  • Add states object, known from template extensions to be the new way of simple state retrievals
  • Add new method get_new that returns the actual State object and remapped state.get() to it
  • Add new method set_new that preserves existing attributes by default, but also allowes them to be updated or removed

The PR will follow soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions