From: Ian B. <ia...@co...> - 2003-06-09 06:41:46
|
On Mon, 2003-06-09 at 01:34, Edmund Lian wrote: > Example: > > class Dog(SQLObject); > _columns = [ > Col("name"), > Col("personId", foreignKey="Person")] > _joins = [ > MultipleJoin("Flea"), > RelatedJoin("Friend")] The new style (which is explained in the documentation I haven't quite finished) is better in this regard: class Dog(SQLObject): name = Col() person = ForeignKey('Person') fleas = MultipleJoin('Flea') friends = RelatedJoin('Friend') addFriend/removeFriend is still implied. Perhaps if I make the join (friends) more powerful it will alleviate even this, so you'd do: aDog.friends.add(aPerson) > When I wrote the message, I was thinking of this problem and said to > myself: "wouldn't it be nice if I could just instantiate the object and > ask it what attributes and methods it had". So I did a obj.__dict__ and > found out that I could not. There must be some way to introspect the > object to get this info... just haven't figured out how yet. SQLObject adds these all to the class, so you should be able to look at obj.__class__.__dict__. Ian |