Massimo fix a bug in crud.select today in trunk maybe it could help! crud.select(db.table)
Now reponse to db.table.field.readable=False and db.table.field.represent='some thing' Richard On Fri, Oct 22, 2010 at 1:15 PM, BigBaaadBob <bigbaaad...@gmail.com> wrote: > I'm probably dense, but I don't see how it does. > > rows.colnames has strings like 'foo.id' and 'a.name'. But you can't > index into a row with those strings: you can't say r['foo.id'] or > r['a.name']. You have to parse the column name and create code like > r['foo']['id'] and the problem I have with that is it seems like > improperly looking into the internals of the Row class. It seems like > the Row class should have some kind of method like r.col('foo.id') > that would "do the right thing". Or that r['a.name'] should just do > the right thing. > > But, again, maybe I'm missing something. > > On Oct 21, 11:24 am, Richard Vézina <ml.richard.vez...@gmail.com> > wrote: > > Maybe this thread could be of some help. > > > > http://groups.google.com/group/web2py/browse_thread/thread/e533b38bd5... > > > > <http://groups.google.com/group/web2py/browse_thread/thread/e533b38bd5.. > .> > > > > On Thu, Oct 21, 2010 at 2:05 PM, BigBaaadBob <bigbaaad...@gmail.com> > wrote: > > > Suppose you do a query like this: > > > > > rows = db((db.a.id==db.foo.xx) & > > > (db.b.id==db.foo.yy)).select(db.foo.id, db.foo.aaa, db.a.name, > > > db.b.name, db.foo.zzz, ....) > > > > > And you want to processes the results generically, say to produce JSON > > > for input to jqGrid. By generically, I mean not having to repeat the > > > "db.foo.aaa, db.a.name" stuff. You know, DRY. > > > > > For r in rows: > > > stuff... > > > > > What is the supported way of doing this? > > > > > Problems I see are: > > > > > * You can't say: r[0] because row is a dict with keys 'a', 'b', and > > > 'foo'. > > > * You can't say: r[rows.colnames[0]] because, well, the same reason > > > as the previous item. > > > > > I see code in the Rows class like this: > > > > > (t, f) = col.split('.') > > > if isinstance(record.get(t, None), (Row,dict)): > > > row.append(none_exception(record[t][f])) > > > > > But I wouldn't want to do that because it assumes the internal > > > structure of the Rows class... > > > > >