Decorator that ensures _mark_as_changed method gets called with the key argument
(parent_method)
| 27 | |
| 28 | |
| 29 | def mark_key_as_changed_wrapper(parent_method): |
| 30 | """Decorator that ensures _mark_as_changed method gets called with the key argument""" |
| 31 | |
| 32 | def wrapper(self, key, *args, **kwargs): |
| 33 | # Can't use super() in the decorator. |
| 34 | if not args or key not in self or self[key] != args[0]: |
| 35 | self._mark_as_changed(key) |
| 36 | return parent_method(self, key, *args, **kwargs) |
| 37 | |
| 38 | return wrapper |
| 39 | |
| 40 | |
| 41 | class BaseDict(dict): |