本文整理汇总了Python中torlite.model.core_tab.CabWiki.create方法的典型用法代码示例。如果您正苦于以下问题:Python CabWiki.create方法的具体用法?Python CabWiki.create怎么用?Python CabWiki.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类torlite.model.core_tab.CabWiki
的用法示例。
在下文中一共展示了CabWiki.create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: insert_data
# 需要导入模块: from torlite.model.core_tab import CabWiki [as 别名]
# 或者: from torlite.model.core_tab.CabWiki import create [as 别名]
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
示例2: insert_data
# 需要导入模块: from torlite.model.core_tab import CabWiki [as 别名]
# 或者: from torlite.model.core_tab.CabWiki import create [as 别名]
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
# 需要导入模块: from torlite.model.core_tab import CabWiki [as 别名]
# 或者: from torlite.model.core_tab.CabWiki import create [as 别名]
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)