本文整理汇总了Python中torcms.model.mcatalog.MCatalog.delete方法的典型用法代码示例。如果您正苦于以下问题:Python MCatalog.delete方法的具体用法?Python MCatalog.delete怎么用?Python MCatalog.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类torcms.model.mcatalog.MCatalog
的用法示例。
在下文中一共展示了MCatalog.delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MaintainCategoryHandler
# 需要导入模块: from torcms.model.mcatalog import MCatalog [as 别名]
# 或者: from torcms.model.mcatalog.MCatalog import delete [as 别名]
class MaintainCategoryHandler(BaseHandler):
def initialize(self):
self.init()
self.mclass = MCatalog()
self.tmpl_router = 'maintain_category'
def get(self, url_str=''):
url_arr = self.parse_url(url_str)
if url_str == 'add':
self.to_add()
elif url_str == 'list':
self.list_catalog()
elif url_arr[0] == 'modify':
self.to_modify(url_arr[1])
elif url_arr[0] == 'delete':
self.delete_by_uid(url_arr[1])
else:
kwd = {
'info': '页面未找到',
}
self.render('html/404.html', kwd=kwd, userinfo = self.userinfo,)
def post(self, url_str=''):
url_arr = self.parse_url(url_str)
if url_arr[0] == 'modify':
self.update(url_arr[1])
elif url_str == 'add':
self.add_catalog()
elif url_arr[0] == 'add':
self.p_add_catalog()
else:
self.redirect('html/404.html')
def list_catalog(self):
kwd = {
'pager': '',
'unescape': tornado.escape.xhtml_unescape,
'title': '最近文档',
}
self.render('{0}/{1}/category_list.html'.format(self.tmpl_name, self.tmpl_router),
kwd=kwd,
view=self.mclass.query_all(by_order=True),
format_date=tools.format_date,
userinfo=self.userinfo,
cfg=config.cfg
)
@tornado.web.authenticated
def to_add(self):
kwd = {
'pager': '',
'uid': '',
}
self.render('{0}/{1}/category_add.html'.format(self.tmpl_name, self.tmpl_router),
topmenu='',
kwd=kwd,
userinfo=self.userinfo,
cfg=config.cfg
)
@tornado.web.authenticated
def update(self, uid):
raw_data = self.mclass.get_by_id(uid)
if self.userinfo.privilege[2] == '1' or raw_data.user_name == self.get_current_user():
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()
if self.tmpl_router == "maintain_category":
self.mclass.update(uid, post_data)
self.redirect('/maintain/category/list'.format(uid))
else:
if self.mclass.update(uid, post_data):
output = {
'addinfo ': 1,
}
else:
output = {
'addinfo ': 0,
}
return json.dump(output, self)
@tornado.web.authenticated
def to_modify(self, id_rec):
a = self.mclass.get_by_id(id_rec)
if self.userinfo.privilege[4] == '1':
pass
#.........这里部分代码省略.........