For some functional tests I'm running, I am fetching a row, clicking on a 
button, and then fetching the same row to see if the button action worked.

I have the following to establish a database connection (using DAL outside 
of web2py environment):
path_to_database = path.join(path.curdir, "databases")
db = DAL('mysql://username:password@localhost/test')
db.import_table_definitions(path_to_database)

I then run the following to fetch a row:

row = db(db.likes.id>0).select().first() 
print row.like_score

which prints "1" as expected

Then I click a button (through Selenium webdriver), which sets the score 
back to "0"
button.click() 
time.sleep(2)

#checking the db, the score is already 0 before the row is fetched        
row2 = db(db.likes.id>0).select().first() 
print row2.like_score

However, the printed score is still "1".

This was not a problem using SQLite, and the score in the database is 0, 
which I confirmed by only fetching the row AFTER the button is clicked. The 
problem arises when fetching the same row more than once.

When fetching the row a 2nd time, I am getting old/obsolete data, instead 
of getting the same row with new data. Any ideas as to how I can fix this?

-- 



Reply via email to