本文整理汇总了Python中torlite.model.core_tab.CabWiki类的典型用法代码示例。如果您正苦于以下问题:Python CabWiki类的具体用法?Python CabWiki怎么用?Python CabWiki使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CabWiki类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:daimon99,项目名称:TorCMS,代码行数:7,代码来源:mwiki.py
示例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)
开发者ID:ifcheung2012,项目名称:TorCMS,代码行数:29,代码来源:mwiki.py
示例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
开发者ID:daimon99,项目名称:TorCMS,代码行数:26,代码来源:mwiki.py
示例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()
开发者ID:ifcheung2012,项目名称:TorCMS,代码行数:7,代码来源:mwiki.py
示例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
开发者ID:Geoion,项目名称:TorCMS,代码行数:8,代码来源:mwiki.py
示例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()
开发者ID:Geoion,项目名称:TorCMS,代码行数:9,代码来源:mwiki.py
示例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()
开发者ID:hitrustnet,项目名称:TorCMS,代码行数:14,代码来源:mwiki.py
示例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()
开发者ID:daimon99,项目名称:TorCMS,代码行数:18,代码来源:mwiki.py
示例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()
开发者ID:Ryan007,项目名称:TorCMS,代码行数:19,代码来源:mwiki.py
示例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)
开发者ID:hitrustnet,项目名称:TorCMS,代码行数:23,代码来源:mwiki.py
示例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()
开发者ID:daimon99,项目名称:TorCMS,代码行数:3,代码来源:mwiki.py
示例12: query_most
def query_most(self, num=8):
return CabWiki.select().order_by(CabWiki.view_count.desc()).limit(num)
开发者ID:daimon99,项目名称:TorCMS,代码行数:2,代码来源:mwiki.py
示例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()
开发者ID:daimon99,项目名称:TorCMS,代码行数:3,代码来源:mwiki.py
示例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)
开发者ID:daimon99,项目名称:TorCMS,代码行数:6,代码来源:mwiki.py
示例15: get_by_title
def get_by_title(self, in_title):
try:
return CabWiki.get(CabWiki.title == in_title)
except:
return None
开发者ID:daimon99,项目名称:TorCMS,代码行数:5,代码来源:mwiki.py
示例16: query_recent
def query_recent(self, num=8):
return CabWiki.select().order_by(CabWiki.time_update.desc()).limit(num)
开发者ID:ifcheung2012,项目名称:TorCMS,代码行数:2,代码来源:mwiki.py
示例17: get_num_by_cat
def get_num_by_cat(self, cat_str):
return CabWiki.select().where(CabWiki.id_cats.contains(',{0},'.format(cat_str))).count()
开发者ID:ifcheung2012,项目名称:TorCMS,代码行数:2,代码来源:mwiki.py
示例18: __init__
def __init__(self):
try:
CabWiki.create_table()
except:
pass
开发者ID:daimon99,项目名称:TorCMS,代码行数:5,代码来源:mwiki.py
示例19: get_by_keyword
def get_by_keyword(self, par2):
return CabWiki.select().where(CabWiki.title.contains(par2)).order_by(CabWiki.time_update.desc()).limit(20)
开发者ID:daimon99,项目名称:TorCMS,代码行数:2,代码来源:mwiki.py
示例20: query_recent_most
def query_recent_most(self, num=8, recent=30):
time_that = int(time.time()) - 30 * 24 * 3600
return CabWiki.select().where(CabWiki.time_update > time_that).order_by(CabWiki.view_count.desc()).limit(num)
开发者ID:ifcheung2012,项目名称:TorCMS,代码行数:3,代码来源:mwiki.py
注:本文中的torlite.model.core_tab.CabWiki类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论