Grid - After update

57 views
Skip to first unread message

Julio César Albornoz

unread,
Jul 28, 2025, 10:13:24 AMJul 28
to py4web
Hi everyone
I want to know if a column has changed, then I would like to encrypt it.
I was doing tests with after_update:

db.tconnection._after_update.append(lambda id, row: fencrypt_pwd('update',id,row))

But this event is triggered several times, then I got wrong values, because it is encrypted a lot a times.

Does anybody have any suggestions for this issue?

Thanks in advance.

Massimo

unread,
Aug 3, 2025, 11:24:18 AMAug 3
to py4web
Many of those magic methods like like _after_update were really meant for py4web and are poorly documented anyway.

I would recommend:

form = Form(..., dbio=False)
if form.aaccepted:
    db.table.insert(x = form.vars.get("x"), y = encrypt(form.vars.get("y"))

Dave S

unread,
Aug 5, 2025, 3:31:41 PMAug 5
to py4web
On Sunday, August 3, 2025 at 8:24:18 AM UTC-7 Massimo wrote:
Many of those magic methods like like _after_update were really meant for py4web

Umm, was that "meant for web2py"?  Venerable, and much loved, but py4web has a lot of "lessons learned" in its design.

 
and are poorly documented anyway.

I would recommend:

form = Form(..., dbio=False)
if form.aaccepted:
    db.table.insert(x = form.vars.get("x"), y = encrypt(form.vars.get("y"))


This looks way too straight-forward.

/dps "wink wink"

Dave S

unread,
Aug 5, 2025, 3:33:19 PMAug 5
to py4web
It always amuses me when GG warns you of "email addresses in post", when those address are already in the message you are replying to.

-d
Reply all
Reply to author
Forward
0 new messages