From 779b1f826b15c7a386c94a98d8f7243a94a84874 Mon Sep 17 00:00:00 2001 From: Dan Pascu Date: Thu, 31 Dec 2015 06:20:51 +0000 Subject: [PATCH] Use defaultweakobjectmap defined in python-application --- sipsimple/addressbook.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/sipsimple/addressbook.py b/sipsimple/addressbook.py index f57c1fc25..fbc3c38ce 100644 --- a/sipsimple/addressbook.py +++ b/sipsimple/addressbook.py @@ -19,7 +19,7 @@ from application.python import Null from application.python.decorator import execute_once from application.python.types import Singleton, MarkerType -from application.python.weakref import weakobjectmap +from application.python.weakref import defaultweakobjectmap from sipsimple.account import xcap, AccountManager from sipsimple.configuration import ConfigurationManager, ObjectNotFoundError, DuplicateIDError, PersistentKey, ModifiedValue, ModifiedList @@ -50,14 +50,6 @@ def __repr__(self): return "%s(%r, %r)" % (self.__class__.__name__, self.account, self.xcap_object) -class defaultweakobjectmap(weakobjectmap): - def __init__(self, factory, *args, **kw): - self.default_factory = factory - super(defaultweakobjectmap, self).__init__(*args, **kw) - def __missing__(self, key): - return self.setdefault(key.object, self.default_factory()) - - class Setting(AbstractSetting): """ Descriptor represeting a setting in an addressbook object.