crud.delete and record versioning error

45 views
Skip to first unread message

Kirill Shatalaev

unread,
Sep 4, 2016, 6:12:53 AM9/4/16
to web...@googlegroups.com
Hello.

In my controller I have


crud.delete(db.comments, comment_id, redirect_after_delete,
message=T('Comment deleted'))

Everything works fine. 
I enabled record versioning in my app and now I got this error:

Traceback (most recent call last):
File "/home/ksh/PycharmProjects/promo/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
File "/home/ksh/PycharmProjects/promo/web2py/applications/promedol/controllers/manage.py", line 423, in <module>
File "/home/ksh/PycharmProjects/promo/web2py/gluon/globals.py", line 417, in <lambda>
self._caller = lambda f: f()
File "/home/ksh/PycharmProjects/promo/web2py/applications/promo/controllers/manage.py", line 319, in delete_comment
message=T('Comment deleted'))
File "/home/ksh/PycharmProjects/promo/web2py/gluon/tools.py", line 5013, in delete
del table[record_id]
File "/home/ksh/venv/web2py/local/lib/python2.7/site-packages/pydal/objects.py", line 604, in __delitem__
raise SyntaxError('No such record: %s' % key)
SyntaxError: No such record: 1007911

Kirill Shatalaev

unread,
Sep 4, 2016, 8:16:24 AM9/4/16
to web2py-users

Well it seems to me del table[record_id] does not work with record versioning according to this old discussion:


So I changed in controller crud.delete to db().delete() 

But I think this is a bug on gluon, am I right?

Massimo Di Pierro

unread,
Sep 6, 2016, 10:39:03 AM9/6/16
to web2py-users
please do not use crud. it has not been supported in long time. just use db(...).delete()

Kirill Shatalaev

unread,
Sep 8, 2016, 5:50:54 AM9/8/16
to web2py-users
So, is CRUD going to be deprecated?

вторник, 6 сентября 2016 г., 18:39:03 UTC+4 пользователь Massimo Di Pierro написал:

Dave S

unread,
Sep 8, 2016, 2:05:25 PM9/8/16
to web2py-users


On Thursday, September 8, 2016 at 2:50:54 AM UTC-7, Kirill Shatalaev wrote:
So, is CRUD going to be deprecated?

That's been discussed in this forum.

The changelog doesn't discuss it, but way back in 1.99.1-1.99.2,
"- new SQLFORM.grid and SQLFORM.smartgrid (should replace crud.search and crud.select)"

Obviously the book is a a little behind, because in Chapter 7 (Forms and Validators) it is referred to as "a recent addition."

/dps

Reply all
Reply to author
Forward
0 new messages