Hello.

In my controller I have

def delete_comment():
    try:
        comment_id = int(request.args(0))
        post_id = get_post_id_by_comment(comment_id)
        commented_post_url = get_post_url(post_id)
        print commented_post_url
        comment = get_comment(comment_id)
    except:
        raise HTTP(404)
    query = ((db.commenting.post_id == post_id) &
             (db.commenting.comment_id == db.comments.id) &
             (db.comments.created_on < comment.comments.created_on))
    previous_comment = db(query).select(db.comments.id, 
orderby=~db.comments.created_on).first()
    post_url = get_post_url(post_id)
    if previous_comment:
        redirect_after_delete = URL(c='default', f='show_comment', 
args=[previous_comment.id])
    else:
        redirect_after_delete = URL(c='default', f='index', 
args=post_url['post_url_assembled'])
    confirmation_form = FORM(INPUT(_type='submit', _value=T('Yes')))
    confirmation_form.add_button(T('No'), URL(c='default', f='show_comment', 
args=[comment_id]))
    if confirmation_form.process().accepted:        
        crud.delete(db.comments, comment_id, redirect_after_delete,
                    message=T('Comment deleted'))
    return dict(form=confirmation_form, comment_id=comment_id)


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"
 <http://127.0.0.1:8000/admin/default/edit/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/promedol/controllers/manage.py"
 <http://127.0.0.1:8000/admin/default/edit/promedol/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

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to