Commit 9b463bef authored by Dan Pascu's avatar Dan Pascu

Use defaultweakobjectmap from python-application

parent 2b48bb56
...@@ -26,7 +26,7 @@ from PyQt4.QtGui import QStyle, QStyledItemDelegate, QStyleOption ...@@ -26,7 +26,7 @@ from PyQt4.QtGui import QStyle, QStyledItemDelegate, QStyleOption
from application.notification import IObserver, NotificationCenter, NotificationData, ObserverWeakrefProxy from application.notification import IObserver, NotificationCenter, NotificationData, ObserverWeakrefProxy
from application.python import Null, limit from application.python import Null, limit
from application.python.types import MarkerType, Singleton from application.python.types import MarkerType, Singleton
from application.python.weakref import weakobjectmap from application.python.weakref import weakobjectmap, defaultweakobjectmap
from eventlib.proc import spawn from eventlib.proc import spawn
from zope.interface import implements from zope.interface import implements
...@@ -355,14 +355,6 @@ class StreamContainer(StreamContainerView): ...@@ -355,14 +355,6 @@ class StreamContainer(StreamContainerView):
self.remove(stream) self.remove(stream)
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 StreamListDescriptor(object): class StreamListDescriptor(object):
def __init__(self): def __init__(self):
self.values = defaultweakobjectmap(StreamMap) self.values = defaultweakobjectmap(StreamMap)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment