本文整理汇总了Python中torcms.model.mcatalog.MCatalog.insert_data方法的典型用法代码示例。如果您正苦于以下问题:Python MCatalog.insert_data方法的具体用法?Python MCatalog.insert_data怎么用?Python MCatalog.insert_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类torcms.model.mcatalog.MCatalog
的用法示例。
在下文中一共展示了MCatalog.insert_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MaintainCategoryHandler
# 需要导入模块: from torcms.model.mcatalog import MCatalog [as 别名]
# 或者: from torcms.model.mcatalog.MCatalog import insert_data [as 别名]
#.........这里部分代码省略.........
def to_modify(self, id_rec):
a = self.mclass.get_by_id(id_rec)
if self.userinfo.privilege[4] == '1':
pass
else:
return False
kwd = {
'pager': '',
}
self.render('{0}/{1}/category_edit.html'.format(self.tmpl_name, self.tmpl_router),
kwd=kwd,
unescape=tornado.escape.xhtml_unescape,
dbrec=a,
userinfo=self.userinfo,
cfg=config.cfg,
)
@tornado.web.authenticated
def add_post(self):
if self.userinfo.privilege[1] == '1':
pass
else:
return False
post_data = {}
for key in self.request.arguments:
post_data[key] = self.get_arguments(key)
post_data['user_name'] = self.get_current_user()
id_post = post_data['uid'][0]
cur_post_rec = self.mclass.get_by_id(id_post)
if cur_post_rec is None:
uid = self.mclass.insert_data(id_post, post_data)
self.redirect('/maintain/category/list'.format(id_post))
@tornado.web.authenticated
def p_add_catalog(self):
if self.userinfo.privilege[1] == '1':
pass
else:
return False
post_data = {}
for key in self.request.arguments:
post_data[key] = self.get_arguments(key)
post_data['user_name'] = self.get_current_user()
cur_uid = tools.get_uudd(2)
while self.mclass.get_by_id(cur_uid):
cur_uid = tools.get_uudd(2)
if self.mclass.insert_data(post_data['uid'], post_data):
output = {
'addinfo ': 1,
}
else:
output = {
'addinfo ': 0,
}
return json.dump(output, self)