def update_vote(self, reply_id, count): entry = CabReply.update( vote=count ).where(CabReply.uid == reply_id) entry.execute()
def update(self, uid, post_data, update_time=False): if 'id_spec' in post_data: id_spec = post_data['id_spec'][0] else: id_spec = 0 if 'src_type' in post_data and post_data['src_type'][0] == '1': cnt_html = tools.rst2html(post_data['cnt_md'][0]) else: cnt_html = tools.markdown2html(post_data['cnt_md'][0]) if update_time == True: entry = CabReply.update( title=post_data['title'][0], date=datetime.datetime.now(), cnt_html=cnt_html, user_name=post_data['user_name'], cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'][0]), time_update=time.time(), id_spec=id_spec, logo=post_data['logo'][0], keywords=post_data['keywords'][0], src_type=post_data['src_type'][0] if ('src_type' in post_data) else 0).where(CabReply.uid == uid) else: entry = CabReply.update( title=post_data['title'][0], # date=datetime.datetime.now(), cnt_html=cnt_html, user_name=post_data['user_name'], cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'][0]), # time_update=time.time(), id_spec=id_spec, logo=post_data['logo'][0], keywords=post_data['keywords'][0], src_type=post_data['src_type'][0] if ('src_type' in post_data) else 0).where(CabReply.uid == uid) entry.execute()
def update(self, uid, post_data, update_time=False): if 'id_spec' in post_data: id_spec = post_data['id_spec'][0] else: id_spec = 0 if 'src_type' in post_data and post_data['src_type'][0] == '1': cnt_html = tools.rst2html(post_data['cnt_md'][0]) else: cnt_html = tools.markdown2html(post_data['cnt_md'][0]) if update_time: entry = CabReply.update( title=post_data['title'][0], date=datetime.datetime.now(), cnt_html=cnt_html, user_name=post_data['user_name'], cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'][0]), time_update=tools.timestamp(), id_spec=id_spec, logo=post_data['logo'][0], keywords=post_data['keywords'][0], src_type=post_data['src_type'][0] if ('src_type' in post_data) else 0 ).where(CabReply.uid == uid) else: entry = CabReply.update( title=post_data['title'][0], cnt_html=cnt_html, user_name=post_data['user_name'], cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'][0]), id_spec=id_spec, logo=post_data['logo'][0], keywords=post_data['keywords'][0], src_type=post_data['src_type'][0] if ('src_type' in post_data) else 0 ).where(CabReply.uid == uid) entry.execute()
def update_vote(self, reply_id, count): entry = CabReply.update(vote=count).where(CabReply.uid == reply_id) entry.execute()
def update_keywords(self, uid, inkeywords): entry = CabReply.update(keywords=inkeywords).where(CabReply.uid == uid) entry.execute()
def update_view_count_by_uid(self, uid): entry = CabReply.update(view_count=CabReply.view_count + 1).where(CabReply.uid == uid) entry.execute()
def update_view_count(self, citiao): entry = CabReply.update(view_count=CabReply.view_count + 1).where(CabReply.title == citiao) entry.execute()