Ok, getting more experienced here I did some nice cleanup to my code.
I managed to get my 100+ line controller to around 30 :-)

I decided to generate new tables for every user. Instead of filtering one 
huge tabe.
The forst time I load the page everything seems fine, although I'm missing 
the add edit etc buttons.
Then I pushed the Export button and I get the aforementioned error. Now 
every time I reload the page,since I have table_token defined the call to 
smartgrid generates this error.

Here is my controller:

def index():
    if session.table_token is None:
        if auth.user:
            session.table_token = db.budgets.last_opened
            user = auth.user.first_name
        else:
            session.table_token = filter(lambda x: x.isalnum(), 
str(uuid.uuid4()))        
            user = 'Guest'
            db.define_table(session.table_token + '_accounts', accounts)
            db.define_table(session.table_token + '_transactions', 
transactions)

    grid = SQLFORM.smartgrid(db[session.table_token + '_transactions'])
    return dict(user=user,grid=grid)

accounts and transactions are db.Table objects which were previously 
defined.

Any help is kindly appreciated


Reply via email to