You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: Changelog.md
+1
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@
5
5
Release 0.8.3 is a minor release and contains several bugfixes mostly related to `HierarchicalStateMachine`:
6
6
7
7
- Feature #473: Assign `is_<model_attribute>_<state_name>` instead of `is_<state_name>` when `model_attribute != "state"` to enable multiple versions of such convenience functions. A warning will be raised when `is_<state_name>` is used. (thanks @artofhuman)
8
+
- Similarly, auto transitions (`to_<state_name>`) will be assigned as `to_<model_attribute>_<state_name>`. `to_<state_name>` will work as before but raise a warning until version 0.9.0.
8
9
- Bugfix: `allow_substates` did not consider enum states
9
10
- Feature: Nested enums can now be passed in a dict as `children` with `initial` parameter
10
11
- Bugfix #449: get_triggers/get_transitions did not return nested triggers correctly (thanks @alexandretanem)
If you'd like you can choose your own state attribute name by passing the `model_attribute` argument while initializing the `Machine`. This will also change the name of `is_«state name»()` to `is_«model_attribute»_«state name»()` though. This is done to allow multiple machines to work on the same model with individual state attribute names.
350
+
If you'd like you can choose your own state attribute name by passing the `model_attribute` argument while initializing the `Machine`. This will also change the name of `is_«state name»()` to `is_«model_attribute»_«state name»()` though. Similarly, auto transitions will be named `to_«model_attribute»_«state name»()` instead of `to_«state name»()`. This is done to allow multiple machines to work on the same model with individual state attribute names.
351
351
352
352
```python
353
353
lump = Matter()
@@ -357,6 +357,8 @@ lump.matter_state
357
357
# with a custom 'model_attribute', states can also be checked like this:
358
358
lump.is_matter_state_solid()
359
359
>>>True
360
+
lump.to_matter_state_gas()
361
+
>>>True
360
362
```
361
363
362
364
#### <aname="enum-state"></a>Enumerations
@@ -966,7 +968,7 @@ machine.add_model(Matter())
966
968
machine.add_model(Matter(), initial='liquid')
967
969
```
968
970
969
-
Models with multiple states could attach multiple machines using different `model_attribute` values. As mentioned in [Checking state](#checking-state), this will add custom `is_<model_attribute>_<state_name>` functions:
971
+
Models with multiple states could attach multiple machines using different `model_attribute` values. As mentioned in [Checking state](#checking-state), this will add custom `is/to_<model_attribute>_<state_name>` functions:
970
972
971
973
```python
972
974
lump = Matter()
@@ -983,6 +985,10 @@ lump.shipping_state
983
985
>>>'delivered'
984
986
lump.is_shipping_state_delivered() # check the custom field.
0 commit comments