本文整理汇总了Python中MoinMoin.action.AttachFile.remove_attachment方法的典型用法代码示例。如果您正苦于以下问题:Python AttachFile.remove_attachment方法的具体用法?Python AttachFile.remove_attachment怎么用?Python AttachFile.remove_attachment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoinMoin.action.AttachFile
的用法示例。
在下文中一共展示了AttachFile.remove_attachment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: nuke_page
# 需要导入模块: from MoinMoin.action import AttachFile [as 别名]
# 或者: from MoinMoin.action.AttachFile import remove_attachment [as 别名]
def nuke_page(request, pagename):
""" completely delete a page, everything in the pagedir """
attachments = AttachFile._get_files(request, pagename)
for attachment in attachments:
AttachFile.remove_attachment(request, pagename, attachment)
page = PageEditor(request, pagename, do_editor_backup=False)
page.deletePage()
# really get rid of everything there:
fpath = page.getPagePath(check_create=0)
shutil.rmtree(fpath, True)
示例2: xmlrpc_deleteAttachment
# 需要导入模块: from MoinMoin.action import AttachFile [as 别名]
# 或者: from MoinMoin.action.AttachFile import remove_attachment [as 别名]
def xmlrpc_deleteAttachment(self, pagename, attachname):
"""
Deletes attachment <attachname> of page <pagename>.
@param pagename: pagename (utf-8)
@param attachname: attachment name (utf-8)
@rtype: bool
@return: True on success
"""
pagename = self._instr(pagename)
if not self.request.user.may.delete(pagename):
return xmlrpclib.Fault(1, 'You are not allowed to delete attachments on this page.')
attachname = wikiutil.taintfilename(self._instr(attachname))
filename = AttachFile.getFilename(self.request, pagename, attachname)
AttachFile.remove_attachment(self.request, pagename, attachname)
return xmlrpclib.Boolean(1)