My apology if a description of the problem is not concise enough. I am
updating record during onvalidaiton process, and this worked until Sep 17.
Anything is possible, but I don't remember changing any code in this area.
When I run the same SQL statement manually, or from a test procedure,
everything works fine, but not when it's executed through SQLFORM
onvalidation process. I tried adding db.commit() and that didn't help,
either.
Finally, I added following query at the end, and then record got updated:
row = db(Order.id==session.order_id).select().first()
My problem seems to be solved for now, but not sure what is a real cause of
the problem, and if something needs correction in executesql?
Simplified code:
def db_encrypt_cc(tbl=None, cc=None, id=None):
TOKEN='xxxxcd7358801fd5db53d74b03xxxx8b7b97a6c4'
sql = "UPDATE %s SET CCnr_secure = AES_ENCRYPT('%s', '%s') WHERE id=%s"
% (tbl, cc, TOKEN, session.order_id)
# when executed, this statement is correct, but no value gets updated
in the table: UPDATE order SET CCnr_secure =
AES_ENCRYPT('4111111111111111', 'xxxxcd7358801fd5db53d74b03xxxx8b7b97a6c4')
WHERE id=10423
db.executesql(sql)
# added code bellow and only then record got updated
row = db(Order.id==session.order_id).select().first()
return
def cc_validation(form):
form.vars.CCnr_secure = db_encrypt_cc("order", form.vars.CCnr)
return
def checkout_cc():
form=SQLFORM(Order, record=record, fields=fields, keepvalues=True,showid
=False,
formstyle='divs', submit_button=T('Continue'))
if form.process(keepvalues=True, onvalidation=cc_validation).accepted:
response.flash = T('Payment Information accepted')
--