def edit_item(no):
if request.GET.get('save','').strip():
name_r = request.GET.get('name', '').strip()
comment_r = request.GET.get('comment', '').strip()
c = conn.cursor()
c.execute("UPDATE comments SET name = ?, comment = ? WHERE id LIKE ?" ,(name_r, comment_r, no))
conn.commit()
return "<script>window.location.replace('/');</script>"
else:
c = conn.cursor()
c.execute("SELECT name, comment FROM comments WHERE id LIKE ?" ,[str(no)])
cur_data = c.fetchone()
#print cur_data
return template('tpl/edit', old=cur_data, no=no)
# ----------------------------------------------------
# ????
评论列表
文章目录