Commits

Sergey Schetinin committed 09058f1

fix UpdateDict.pop() (did not support any arguments) and .setdefault() (was not returning anything) [from pycon2011 sprint w/ edits]

Comments (0)

Files changed (1)

webob/cachecontrol.py

 """
 import re
 
-
 class UpdateDict(dict):
     """
     Dict that has a callback on all updates
         dict.update(self, *args, **kw)
         self._updated()
 
-    def setdefault(self, key, failobj=None):
-        dict.setdefault(self, key, failobj)
-        self._updated()
-    def pop(self):
-        v = dict.pop(self)
+    def setdefault(self, key, value=None):
+        val = dict.setdefault(self, key, value)
+        if val is value:
+            self._updated()
+        return val
+
+    def pop(self, *args):
+        v = dict.pop(self, *args)
         self._updated()
         return v