diff --git a/django/dispatch/saferef.py b/django/dispatch/saferef.py index d8728e219a..84d1b2183c 100644 --- a/django/dispatch/saferef.py +++ b/django/dispatch/saferef.py @@ -149,9 +149,11 @@ class BoundMethodWeakref(object): self.selfName, self.funcName, ) - + __repr__ = __str__ - + + __hash__ = object.__hash__ + def __bool__( self ): """Whether we are still a valid reference""" return self() is not None diff --git a/tests/regressiontests/dispatch/tests/test_saferef.py b/tests/regressiontests/dispatch/tests/test_saferef.py index cfe6c5df85..30eaddfe18 100644 --- a/tests/regressiontests/dispatch/tests/test_saferef.py +++ b/tests/regressiontests/dispatch/tests/test_saferef.py @@ -54,10 +54,8 @@ class SaferefTests(unittest.TestCase): sd[s] = 1 for t in self.ts: if hasattr(t, 'x'): - self.assertTrue(sd.has_key(safeRef(t.x))) self.assertTrue(safeRef(t.x) in sd) else: - self.assertTrue(sd.has_key(safeRef(t))) self.assertTrue(safeRef(t) in sd) def testRepresentation(self):