本文整理匯總了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)