[PEAK] Read/write delegation

John Landahl john at landahl.org
Tue Feb 24 17:48:45 EST 2004


When using binding.Delegate, reading a delegated property works just fine, 
but property assignments don't seem to get propagated.  The following 
code...

   from peak.api import binding, config

   r = config.makeRoot()

   class A(binding.Component):
       x = binding.Make(lambda: 1)

   class B(binding.Component):
       x = binding.Delegate('a')
       a = binding.Make(A)

   b = B(r)
   print b.x, b.a.x

   b.x = 2
   print b.x, b.a.x

...prints '1 1\n2 1', indicating that 'b.x = 2' did not get propagated to 
b.a.x.  Is this by design?



More information about the PEAK mailing list