aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/odict.py
diff options
context:
space:
mode:
Diffstat (limited to 'netlib/odict.py')
-rw-r--r--netlib/odict.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/netlib/odict.py b/netlib/odict.py
index 0759a5bf..8e195afc 100644
--- a/netlib/odict.py
+++ b/netlib/odict.py
@@ -1,4 +1,6 @@
import re, copy
+from netlib.stateobject import StateObject
+
def safe_subn(pattern, repl, target, *args, **kwargs):
"""
@@ -9,7 +11,7 @@ def safe_subn(pattern, repl, target, *args, **kwargs):
return re.subn(str(pattern), str(repl), target, *args, **kwargs)
-class ODict:
+class ODict(StateObject):
"""
A dictionary-like object for managing ordered (key, value) data.
"""
@@ -98,6 +100,9 @@ class ODict:
def _get_state(self):
return [tuple(i) for i in self.lst]
+ def _load_state(self, state):
+ self.list = [list(i) for i in state]
+
@classmethod
def _from_state(klass, state):
return klass([list(i) for i in state])