Near of it... Your list comprehension is doing much simpler then I were
doing what it should do.

But the problem is still there...

First the

[f for f in db['table1'].fields if f not in BlackList]

Return a list (['field1','field2', etc.]) without the rest of the
information needed : "db.table"

I was having in a :

'db.table.field1, db.table.field2, etc.'

Second it is a list.

My fundamental problem is that I try tu use the content of a variable as
code for my app and that should not be a common thing in programmation since
I am not a experienced programmer.

I don't know if I should do something else to resolve my problem...

Basically I would do exactly the inverse of columns= do in SQLTABLE

Richard



On Tue, Oct 19, 2010 at 10:52 PM, DenesL <[email protected]> wrote:

> Hello Richard,
>
> if I understood correctly, you want:
>
> ...
> BlackList = [ 'fieldx', 'fieldy', ...]
> rows = db().select(*[f for f in db['table1'].fields if f not in
> BlackList])
> ...
>
> Denes
>
> On Oct 19, 6:14 pm, Richard Vézina <[email protected]>
> wrote:
> > Hello,
> >
> > I would do this :
> >
> > def grid():
> >     if request.args[0] in tableSubSet:
> >         allFieldsSet=set(db['table1'].fields) # all the fields in the
> table
> >         fieldsBlackListSet=set(['f1ToRem','f2ToRem','f1ToRem']) # fields
> to
> > be remove from the grid
> >         allFieldsSet-=fieldsBlackListSet # removing fields to be removed
> >         fieldsRequested=[]
> >         for field in allFieldsSet:
> >             fieldsRequestedList.append('db.test_activity.'+field) #
> building
> > the select list of elements
> >
> >         a=','.join(fieldsRequestedList) # transform the list into a
> string
> >
> >         rows = db().select(a) # BLOCKED BECAUSE OF THE QUOTES
> > (*'*db.table1.field1,
> > db.table1.field2, etc.*'*)!!!
> >         table=SQLTABLE(rows)
> >         return dict(table=table)
> >
> > Thanks for your help.
> >
> > Richard
>

Reply via email to