From: <jws...@ra...> - 2004-02-20 04:39:58
|
>class CustomerAccount(SQLObject): > # private composition > _buyer = ForeignKey('Buyer') > > # public proxy > def _get_emailAddr(self): ^^^^^^^^^^^^^^^^^^^^ > # this could also have proxy at Buyer obj to buyerInfo, so like: > # return self._buyer.emailAddr == > return self._buyer.buyerInfo.emailAddr > > >makes this work: > >x = CustomerAccount(id) >print x.emailAddr I don't understand this magic, but it seems to be working for me. I still have to specify all my classes by hand, though. If I do a dir() on an instance of my class, I get a list of ALL private and public attributes. What is the best way for a program containing my SQLOject to get a list of the public attributes that object exposed in it's definition, excluding private and inherited items? The printable representation of the object looks like <Customer 6 name='ACME' buyerID=1> '_columns' lists the real columns, but not the proxied ones. I could also just add a method in my class to return a list of fields. I'm thinking of generating a gui form based on what the object tells me it's fields are. |