Пример #1
0
    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 = CabUser2Reply.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(
                    CabUser2Reply.uid == uid)
        else:
            entry = CabUser2Reply.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(
                    CabUser2Reply.uid == uid)
        entry.execute()
Пример #2
0
    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 = CabUser2Reply.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(CabUser2Reply.uid == uid)
        else:
            entry = CabUser2Reply.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(CabUser2Reply.uid == uid)
        entry.execute()
Пример #3
0
 def update_keywords(self, uid, inkeywords):
     entry = CabUser2Reply.update(keywords=inkeywords).where(CabUser2Reply.uid == uid)
     entry.execute()
Пример #4
0
 def update_view_count_by_uid(self, uid):
     entry = CabUser2Reply.update(view_count=CabUser2Reply.view_count + 1).where(CabUser2Reply.uid == uid)
     entry.execute()
Пример #5
0
 def update_view_count(self, citiao):
     entry = CabUser2Reply.update(view_count=CabUser2Reply.view_count + 1).where(CabUser2Reply.title == citiao)
     entry.execute()
Пример #6
0
 def update_keywords(self, uid, inkeywords):
     entry = CabUser2Reply.update(keywords=inkeywords).where(
         CabUser2Reply.uid == uid)
     entry.execute()
Пример #7
0
 def update_view_count_by_uid(self, uid):
     entry = CabUser2Reply.update(view_count=CabUser2Reply.view_count +
                                  1).where(CabUser2Reply.uid == uid)
     entry.execute()
Пример #8
0
 def update_view_count(self, citiao):
     entry = CabUser2Reply.update(view_count=CabUser2Reply.view_count +
                                  1).where(CabUser2Reply.title == citiao)
     entry.execute()