diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-02-08 02:10:10 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-02-08 02:10:10 +0100 |
commit | e9934cc008417cb1aed694f7f24133abac0815eb (patch) | |
tree | 2ddfcf62c8aaa65edb95918484971c74ad6f206a /libmproxy/stateobject.py | |
parent | cd744592f6dfebf9ba00ce8a35828b49fec1af5c (diff) | |
download | mitmproxy-e9934cc008417cb1aed694f7f24133abac0815eb.tar.gz mitmproxy-e9934cc008417cb1aed694f7f24133abac0815eb.tar.bz2 mitmproxy-e9934cc008417cb1aed694f7f24133abac0815eb.zip |
simplify state management
Diffstat (limited to 'libmproxy/stateobject.py')
-rw-r--r-- | libmproxy/stateobject.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/libmproxy/stateobject.py b/libmproxy/stateobject.py index 52a8347f..6f15ae7a 100644 --- a/libmproxy/stateobject.py +++ b/libmproxy/stateobject.py @@ -13,24 +13,20 @@ class StateObject(object): # should be serialized. If the attribute is a class, it must implement the # StateObject protocol. _stateobject_attributes = None - # A set() of attributes that should be ignored for short state - _stateobject_long_attributes = frozenset([]) def from_state(self, state): raise NotImplementedError() - def get_state(self, short=False): + def get_state(self): """ Retrieve object state. If short is true, return an abbreviated format with long data elided. """ state = {} for attr, cls in self._stateobject_attributes.iteritems(): - if short and attr in self._stateobject_long_attributes: - continue val = getattr(self, attr) if hasattr(val, "get_state"): - state[attr] = val.get_state(short) + state[attr] = val.get_state() else: state[attr] = val return state |