本文整理汇总了Python中torlite.model.core_tab.CabWiki类的典型用法代码示例。如果您正苦于以下问题:Python CabWiki类的具体用法?Python CabWiki怎么用?Python CabWiki使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CabWiki类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_by_wiki
def get_by_wiki(self, citiao):
tt = CabWiki.select().where(CabWiki.title == citiao).count()
if tt == 0:
return None
else:
self.update_view_count(citiao)
return CabWiki.get(CabWiki.title == citiao)
示例2: insert_data
def insert_data(self, post_data):
title = post_data['title'][0]
uu = self.get_by_wiki(title)
if uu is None:
pass
else:
return (False)
if 'id_spec' in post_data:
id_spec = post_data['id_spec'][0]
else:
id_spec = 0
if 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])
entry = CabWiki.create(
title=post_data['title'][0],
date=datetime.datetime.now(),
cnt_html=cnt_html,
uid=tools.get_uu8d(),
time_create=time.time(),
user_name=post_data['user_name'],
cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'][0]),
time_update=time.time(),
view_count=1,
src_type=post_data['src_type'][0]
)
return (entry.uid)
示例3: insert_data
def insert_data(self, post_data):
title = post_data["title"][0]
uu = self.get_by_wiki(title)
if uu is None:
pass
else:
return False
if 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])
entry = CabWiki.create(
title=post_data["title"][0],
date=datetime.datetime.now(),
cnt_html=cnt_html,
uid=tools.get_uu8d(),
time_create=tools.timestamp(),
user_name=post_data["user_name"],
cnt_md=tornado.escape.xhtml_escape(post_data["cnt_md"][0]),
time_update=tools.timestamp(),
view_count=1,
src_type=post_data["src_type"][0],
)
return entry.uid
示例4: get_previous_record
def get_previous_record(self, in_uid):
current_rec = self.get_by_id(in_uid)
query = CabWiki.select().where(CabWiki.time_update > current_rec.time_update).order_by(CabWiki.time_update)
if query.count() == 0:
return None
else:
return query.get()
示例5: query_cat_by_pager
def query_cat_by_pager(self, cat_str, cureent):
tt = (
CabWiki.select()
.where(CabWiki.id_cats.contains(str(cat_str)))
.order_by(CabWiki.time_update.desc())
.paginate(cureent, config.page_num)
)
return tt
示例6: get_next_record
def get_next_record(self, in_uid):
current_rec = self.get_by_id(in_uid)
query = (
CabWiki.select().where(CabWiki.time_update < current_rec.time_update).order_by(CabWiki.time_update.desc())
)
if query.count() == 0:
return None
else:
return query.get()
示例7: update
def update(self, uid, post_data):
cnt_html = tools.markdown2html(post_data['cnt_md'][0])
entry = CabWiki.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(),
).where(CabWiki.uid == uid)
entry.execute()
示例8: update
def update(self, uid, post_data):
print(post_data["src_type"][0])
if 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])
entry = CabWiki.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(),
src_type=post_data["src_type"][0],
).where(CabWiki.uid == uid)
entry.execute()
示例9: update
def update(self, uid, post_data):
print(post_data['src_type'][0])
if 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])
entry = CabWiki.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(),
src_type=post_data['src_type'][0]
).where(CabWiki.uid == uid)
entry.execute()
示例10: insert_data
def insert_data(self, post_data):
title = post_data['title'][0]
uu = self.get_by_wiki(title)
if uu is None:
pass
else:
return (False)
cnt_html = tools.markdown2html(post_data['cnt_md'][0])
entry = CabWiki.create(
title=post_data['title'][0],
date=datetime.datetime.now(),
cnt_html=cnt_html,
uid=tools.get_uu8d(),
time_create=tools.timestamp(),
user_name=post_data['user_name'],
cnt_md=tornado.escape.xhtml_escape(post_data['cnt_md'][0]),
time_update=tools.timestamp(),
view_count=1,
)
return (entry.uid)
示例11: update_view_count_by_uid
def update_view_count_by_uid(self, uid):
entry = CabWiki.update(view_count=CabWiki.view_count + 1).where(CabWiki.uid == uid)
entry.execute()
示例12: query_most
def query_most(self, num=8):
return CabWiki.select().order_by(CabWiki.view_count.desc()).limit(num)
示例13: update_view_count
def update_view_count(self, citiao):
entry = CabWiki.update(view_count=CabWiki.view_count + 1).where(CabWiki.title == citiao)
entry.execute()
示例14: get_by_id
def get_by_id(self, in_uid):
tt = CabWiki.select().where(CabWiki.uid == in_uid).count()
if tt == 0:
return None
else:
return CabWiki.get(CabWiki.uid == in_uid)
示例15: get_by_title
def get_by_title(self, in_title):
try:
return CabWiki.get(CabWiki.title == in_title)
except:
return None