I am using 1.9.1.4

I see a strange behavior

I am doing this simple test;

def update():
    rows = db((db.nums.hold==False) & (db.nums.active==False)).select()
    for row in rows.find(lambda row: row.num[len(row.num)-2:]=='55'):
        row.update(hold=True)
        db.commit()

    return locals()

The view I have this

{{=rows }}

I see the row 55 has been updated with the "hold" status as True;

However this update does not persist to the DB;

after I have run the above code; I change to...


def update():
    rows = db((db.nums.hold==False) & (db.nums.active==False)).select()
    for row in rows.find(lambda row: row.num[len(row.num)-2:]=='56'):
        row.update(hold=True)
        db.commit()

    return locals()


I will see row 55 with the "hold" status of False (which should be True as per our previous update) and then 56 should show True as well.


I am not sure why I am experiencing this;


The only thing I can think of is that perhaps because I specify this value as false in the table definition it keeps returning to false?

db.define_table('nums',signature,
    Field('num','string'),
    Field('active','boolean',default=False),
    Field('hold','boolean',default=False),
    )



Reply via email to