From: Chris G. <ch...@il...> - 2004-03-10 11:32:31
|
Ian answered your first question, so I'll field the second one. :) "Clifford Ilkay" <cli...@di...> wrote in message news:200...@di...... > testdb=# select * from person; > id | last_name | is_member | first_name > ----+-----------+-----------+------------ > 1 | Duck | t | Donald > 2 | Mouse | t | Mickey > 3 | Mouse | t | Minnie > 4 | Dog | t | Pluto > 5 | Dog | t | Goofy > (5 rows) > > As you can see, I tried various ways of expressing "False" but none of them > seemed to work. What am I missing? Also, why is the order of the columns not > the same as the order that was specified in the class definition? I haven't looked this up, but this is probably what's happening: When you create a subclass of an SQLObject, you're creating a new python object. To create the table, SQLObject has to inspect this python object's attributes to see which of them are Col() classes. Now, internally, python stores all the attributes of a class in a dict(), so that when you look up an attribute, it just does a lookup in the dict(). The reason they're out of order is that dictionaries don't maintain any kind of order. The order of the things in a dictionary depends on the order you inserted them. So, basically, either SQLObject would have to pre-sort the dictionary, or it would have to be psychic. I've been doing some research into psychic computing, and the early results have been promising, so don't rule that out! :) |