|
@@ -556,11 +556,11 @@ DOM = DOM() |
|
|
class Collection(UserDict): |
|
|
class Collection(UserDict): |
|
|
"""Helper class for maintaining ordered named collections.""" |
|
|
"""Helper class for maintaining ordered named collections.""" |
|
|
default = lambda k: k.name |
|
|
default = lambda k: k.name |
|
|
def __init__(self, parent, key=Collection.default): |
|
|
|
|
|
|
|
|
def __init__(self, parent, key=None): |
|
|
UserDict.__init__(self) |
|
|
UserDict.__init__(self) |
|
|
self.parent = weakref.ref(parent) |
|
|
self.parent = weakref.ref(parent) |
|
|
self.list = [] |
|
|
self.list = [] |
|
|
self._func = key |
|
|
|
|
|
|
|
|
self._func = key or self.default |
|
|
|
|
|
|
|
|
def __getitem__(self, key): |
|
|
def __getitem__(self, key): |
|
|
if type(key) is type(1): |
|
|
if type(key) is type(1): |
|
|