Beispiel #1
0
    def update(self, uid, post_data, update_time=False):

        cnt_html = tools.markdown2html(post_data['cnt_md'][0])

        try:
            if update_time:
                entry2 = CabPost.update(
                    time_update=time.time()
                ).where(CabPost.uid == uid)
                entry2.execute()
        except:
            pass

        try:
            entry = CabPost.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]),
                logo=post_data['logo'][0],
                keywords=post_data['keywords'][0],
            ).where(CabPost.uid == uid)
            entry.execute()
        except:
            return  False
Beispiel #2
0
 def update_view_count_by_uid(self, uid):
     entry = CabPost.update(view_count=CabPost.view_count + 1).where(CabPost.uid == uid)
     try:
         entry.execute()
         return True
     except:
         return False
Beispiel #3
0
 def update_view_count_by_uid(self, uid):
     entry = CabPost.update(view_count=CabPost.view_count +
                            1).where(CabPost.uid == uid)
     try:
         entry.execute()
         return True
     except:
         return False
Beispiel #4
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 = CabPost.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(CabPost.uid == uid)
        else:
            entry = CabPost.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(CabPost.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 = CabPost.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(CabPost.uid == uid)
        else:
            entry = CabPost.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(CabPost.uid == uid)
        entry.execute()
Beispiel #6
0
    def update(self, uid, post_data, update_time=False):

        cnt_html = tools.markdown2html(post_data['cnt_md'][0])

        try:
            if update_time:
                entry2 = CabPost.update(time_update=time.time()).where(
                    CabPost.uid == uid)
                entry2.execute()
        except:
            pass

        try:
            entry = CabPost.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]),
                logo=post_data['logo'][0],
                keywords=post_data['keywords'][0],
            ).where(CabPost.uid == uid)
            entry.execute()
        except:
            return False
Beispiel #7
0
 def update_keywords(self, uid, inkeywords):
     entry = CabPost.update(keywords=inkeywords).where(CabPost.uid == uid)
     entry.execute()
Beispiel #8
0
 def update_view_count_by_uid(self, uid):
     entry = CabPost.update(view_count=CabPost.view_count +
                            1).where(CabPost.uid == uid)
     entry.execute()
Beispiel #9
0
 def update_view_count(self, citiao):
     entry = CabPost.update(view_count=CabPost.view_count +
                            1).where(CabPost.title == citiao)
     entry.execute()
 def update_keywords(self, uid, inkeywords):
     entry = CabPost.update(keywords=inkeywords).where(CabPost.uid == uid)
     entry.execute()
 def update_view_count_by_uid(self, uid):
     entry = CabPost.update(view_count=CabPost.view_count + 1).where(CabPost.uid == uid)
     entry.execute()
 def update_view_count(self, citiao):
     entry = CabPost.update(view_count=CabPost.view_count + 1).where(CabPost.title == citiao)
     entry.execute()