本文整理汇总了Python中plugin.Plugin.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Plugin.delete方法的具体用法?Python Plugin.delete怎么用?Python Plugin.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plugin.Plugin
的用法示例。
在下文中一共展示了Plugin.delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete
# 需要导入模块: from plugin import Plugin [as 别名]
# 或者: from plugin.Plugin import delete [as 别名]
def delete(self, key):
try:
plugin = Plugin(key)
except DoesNotExist:
abort(404)
plugin.delete(plugin.key)
return {'result': 'success'}
示例2: plugin_delete
# 需要导入模块: from plugin import Plugin [as 别名]
# 或者: from plugin.Plugin import delete [as 别名]
def plugin_delete(key):
message = None
if request.method == 'POST':
show_form = False
try:
plugin = Plugin(key)
title = 'Plugin {} version {} deleted'.format(plugin.name, plugin.version)
plugin.delete(key)
log("Plugin %s has been deleted" % key)
except DoesNotExist:
return render_error('<b>{}</b> does not exists'.format(key))
else:
try:
plugin = Plugin(key)
title = 'Confirm deletion of Plugin {} version {}?'.format(plugin.name, plugin.version)
show_form = True
log("Plugin %s deletion confirmation asked" % key)
except DoesNotExist:
return render_error('{} does not exists'.format(key))
return render_template('delete.html',
title=title,
plugin=plugin,
show_form=show_form,
message=message)