In my scheduler i have some code that sets a flag on a database record
then remove its after the process is completed. During imports I
needed a way to have my app not allow some other actions to take
place. So i figure i would just write out a record to the DB that the
other code could test for when running. Seemed pretty straight
forward. If during the import the flag doesn't exist it also creates
it. Since I need to update the status right away i set the flag at the
beginning and do a transaction commit. This works. Then at the end i
set the value to 0 and commit again. It returns no errors but doesn't
update the DB.
def importOrders():
import_flag =
DBSession.query(Flag).filter(Flag.flag_name=='import_flag').first()
if not import_flag:
import_flag = Flag('import_flag')
DBSession.add(import_flag)
import_flag.flag_value = 1
transaction.commit()
... # Do stuff
import_flag.flag_value = 0
transaction.commit()
The flag will get created and always gets set to 1 but never gets set
to zero.
PK
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en.