diff options
author | Paul McGuire <ptmcg@austin.rr.com> | 2019-04-17 18:08:35 -0500 |
---|---|---|
committer | Paul McGuire <ptmcg@austin.rr.com> | 2019-04-17 18:08:35 -0500 |
commit | f0264bd8d1a548a50b3e5f7d99cfefd577942d14 (patch) | |
tree | c37f35dcd201afedc03b3f38f0191d7d2005aade /examples/statemachine/libraryBookDemo.py | |
parent | a0d49ee85f83348ad694b716b18c7cca604ca3ca (diff) | |
download | pyparsing-git-f0264bd8d1a548a50b3e5f7d99cfefd577942d14.tar.gz |
Fix generated stateMixin class to properly implement overridable transition methods instead of messing with getattr; allows use of `super().transition_name()` in classes that subclass from the Mixin
Diffstat (limited to 'examples/statemachine/libraryBookDemo.py')
-rw-r--r-- | examples/statemachine/libraryBookDemo.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/statemachine/libraryBookDemo.py b/examples/statemachine/libraryBookDemo.py index 95e5996..5e73f07 100644 --- a/examples/statemachine/libraryBookDemo.py +++ b/examples/statemachine/libraryBookDemo.py @@ -24,9 +24,9 @@ class RestrictedBook(Book): # specialized checkout to check permission of user first def checkout(self, user=None): if user in self._authorized_users: - self._state = self._state.checkout() + super().checkout() else: - raise Exception("{0} could not check out restricted book".format((user, "anonymous")[user is None])) + raise Exception("{0} could not check out restricted book".format(user if user is not None else "anonymous")) def run_demo(): |