Are you having trouble with the line:

auth.user.my_budgets.append(session.table_token)

Or with return? I only ask because the above line assumes that the current 
user object has a list by the name of my_budgets. Is this list created 
somewhere else in the code? Also, because the user may not actually be 
logged in at the time this code is run, auth.user may equal None.

The best thing to do here is make sure you're running web2py from the 
command line, then insert this line at the beginning of the 
register_new_table_token() function:

import pdb; pdb.set_trace()

This will cause web2py to stop so that you can use the command line to 
inspect variables and such. Once this line is called, the command line will 
show a prompt that looks like "(Pdb)". From here, type "print auth.user" to 
get the current auth.user information, enter "n" to continue execution to 
the next line and stop again, or "c" to continue execution like normal.

This standard Python debugging technique is something I use frequently when 
I have code doing something unexpected.

Reply via email to