I have a question about MiddleObject's valueForKey() method. But first
let me complement the authors of WebWare and MiddleKit:
I'm exploring the wonders of NamedValueAccess.py. What a fantastically
useful module. For a while I did not see the difference with python's
regular getattr() methods. But now I see that it can be used for
dynamic access to attributes without worrying if they have accessor
methods around them. E.g. person.getValueForKey( 'name' ) where 'name'
is actually defined in my GUI builder. Thus I can control what value
is retrieved in my GUI designer without changing code. Also the
valueForName() is great for accessing values inside values, e.g.
person.getValueForName('phonenums.mobile.areacode') will go down 3
levels of objects to get my area code. Amazing!
Now my question. I am using MiddleKit, and it overrides valueForKey()
to lookup a key in the model only. I have a Person object with
attributes something like this:
I want to call:
thePerson.valueForKey( 'fullName' )
where fullName() is a method in Person.py that will combine the
firstName and lastName. But unfortunately, MiddleObject overrides
valueForKey() so that it only checks attributes defined in the model.
So any convenience methods defined in my customized Person.py module
are not checked. Is there a reason for this? It seems to me if the
MiddleObject did not override valueForKey(), things would still work
and would be more general?
winston wolff - (646) 827-2242 - http://www.stratolab.com - learning by