Various fixes and debugging of weak-ref changes

This commit is contained in:
Griatch 2014-05-10 19:38:23 +02:00
parent 0030530021
commit 63c099c22f
6 changed files with 24 additions and 81 deletions

View file

@ -1081,3 +1081,16 @@ class LazyLoadHandler(object):
def __unicode__(self):
return str(_GA(self, "_instantiate")())
class NonWeakLazyLoadHandler(LazyLoadHandler):
"""
Variation of LazyLoadHandler that does not
create a weak reference when initiating.
"""
def _instantiate(self):
"""
Initialize handler as cls(obj, *args)
"""
obj = _GA(self, "obj")()
instance = _GA(self, "cls")(obj, *_GA(self, "args"))
_SA(obj, _GA(self, "name"), instance)
return instance