Changeset 558

Show
Ignore:
Timestamp:
06/12/03 15:34:25 (5 years ago)
Author:
sholloway
Message:

Added LazyObjectProperty?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/RBFoundation/RBFoundation/Objects/Properties.py

    r554 r558  
    2424#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    2525 
    26 from RBFoundation import BindCallable 
     26from RBFoundation import ContextApply 
    2727 
    2828#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     
    7979 
    8080    def __init__(self, LazyFactory, *args, **kw): 
    81         self.LazyFactory = BindCallable.CurryCallable(LazyFactory, *args, **kw) 
     81        self.LazyFactory = ContextApply.ContextApply_s(LazyFactory, *args, **kw) 
    8282 
    8383    def GetValue(self, obj): 
    8484        return self.LazyFactory() 
    8585 
     86#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     87 
     88class LazyObjectProperty(CachedPropertyBase): 
     89    namePrefix = '__lazy_' 
     90 
     91    def __init__(self, LazyFactory, *args, **kw): 
     92        self.LazyFactory = ContextApply.ContextApply_p_s(LazyFactory, *args, **kw) 
     93 
     94    def GetValue(self, obj): 
     95        return self.LazyFactory(obj) 
     96