aboutsummaryrefslogtreecommitdiffstats
path: root/netlib
diff options
context:
space:
mode:
Diffstat (limited to 'netlib')
-rw-r--r--netlib/http/message.py6
-rw-r--r--netlib/multidict.py3
2 files changed, 9 insertions, 0 deletions
diff --git a/netlib/http/message.py b/netlib/http/message.py
index 9b0180cf..028f43a1 100644
--- a/netlib/http/message.py
+++ b/netlib/http/message.py
@@ -26,6 +26,9 @@ class MessageData(utils.Serializable):
def __ne__(self, other):
return not self.__eq__(other)
+ def __hash__(self):
+ return hash(frozenset(self.__dict__.items()))
+
def set_state(self, state):
for k, v in state.items():
if k == "headers":
@@ -52,6 +55,9 @@ class Message(utils.Serializable):
def __ne__(self, other):
return not self.__eq__(other)
+ def __hash__(self):
+ return hash(self.data) ^ 1
+
def get_state(self):
return self.data.get_state()
diff --git a/netlib/multidict.py b/netlib/multidict.py
index 3af7979b..248acdec 100644
--- a/netlib/multidict.py
+++ b/netlib/multidict.py
@@ -81,6 +81,9 @@ class _MultiDict(MutableMapping, Serializable):
def __ne__(self, other):
return not self.__eq__(other)
+ def __hash__(self):
+ return hash(self.fields)
+
def get_all(self, key):
"""
Return the list of all values for a given key.