本文整理汇总了Python中tractags.api.TagSystem.delete_tags方法的典型用法代码示例。如果您正苦于以下问题:Python TagSystem.delete_tags方法的具体用法?Python TagSystem.delete_tags怎么用?Python TagSystem.delete_tags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tractags.api.TagSystem
的用法示例。
在下文中一共展示了TagSystem.delete_tags方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: screenshot_deleted
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import delete_tags [as 别名]
def screenshot_deleted(self, req, screenshot):
# Create temporary resource.
resource = Resource('screenshots', to_unicode(screenshot['id']))
# Delete tags of screenshot.
tag_system = TagSystem(self.env)
tag_system.delete_tags(req, resource)
示例2: download_deleted
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import delete_tags [as 别名]
def download_deleted(self, req, download):
# Check proper permissions to modify tags.
if not req.perm.has_permission('TAGS_MODIFY'):
return
# Create temporary resource.
resource = Resource('downloads', download['id'])
# Delete tags of download.
tag_system = TagSystem(self.env)
tag_system.delete_tags(req, resource)
示例3: screenshot_created
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import delete_tags [as 别名]
def screenshot_created(self, req, screenshot):
# Create temporary resource.
resource = Resource('screenshots', to_unicode(screenshot['id']))
# Delete tags of screenshot with same ID for sure.
tag_system = TagSystem(self.env)
tag_system.delete_tags(req, resource)
# Add tags of new screenshot.
new_tags = self._get_tags(screenshot)
tag_system.add_tags(req, resource, new_tags)
示例4: screenshot_changed
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import delete_tags [as 别名]
def screenshot_changed(self, req, screenshot, old_screenshot):
# Update old screenshot with new values.
old_screenshot.update(screenshot)
# Create temporary resource.
resource = Resource('screenshots', to_unicode(old_screenshot['id']))
# Delete old tags.
tag_system = TagSystem(self.env)
tag_system.delete_tags(req, resource)
# Add new ones.
new_tags = self._get_tags(old_screenshot)
tag_system.add_tags(req, resource, new_tags)
示例5: download_created
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import delete_tags [as 别名]
def download_created(self, context, download):
# Check proper permissions to modify tags.
if not context.req.perm.has_permission('TAGS_MODIFY'):
return
# Create temporary resource.
resource = Resource(self.realm, download['id'])
# Delete tags of download with same ID for sure.
tag_system = TagSystem(self.env)
tag_system.delete_tags(context.req, resource)
# Add tags of new download.
new_tags = self._get_tags(download)
self.log.debug('tags: %s' % (new_tags,))
tag_system.add_tags(context.req, resource, new_tags)
示例6: download_created
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import delete_tags [as 别名]
def download_created(self, req, download):
# Check proper permissions to modify tags.
if not req.perm.has_permission('TAGS_MODIFY'):
return
# Create temporary resource.
resource = Resource()
resource.realm = 'downloads'
resource.id = download['id']
# Delete tags of download with same ID for sure.
tag_system = TagSystem(self.env)
tag_system.delete_tags(req, resource)
# Add tags of new download.
new_tags = self._get_tags(download)
tag_system.add_tags(req, resource, new_tags)
示例7: download_changed
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import delete_tags [as 别名]
def download_changed(self, req, download, old_download):
# Check proper permissions to modify tags.
if not req.perm.has_permission('TAGS_MODIFY'):
return
# Check if tags has to be updated.
if not self._has_tags_changed(download):
return
# Update old download with new values.
old_download.update(download)
# Create temporary resource.
resource = Resource('downloads', old_download['id'])
# Delete old tags.
tag_system = TagSystem(self.env)
tag_system.delete_tags(req, resource)
# Add new ones.
new_tags = self._get_tags(old_download)
tag_system.add_tags(req, resource, new_tags)
示例8: _delete_tags
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import delete_tags [as 别名]
def _delete_tags(self, req, resource):
# Delete tags of the resource.
tag_system = TagSystem(self.env)
tag_system.delete_tags(req, resource)
示例9: wiki_page_deleted
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import delete_tags [as 别名]
def wiki_page_deleted(self, page):
tag_system = TagSystem(self.env)
# XXX Ugh. Hopefully this will be sufficient to full any endpoints.
from trac.test import Mock, MockPerm
req = Mock(authname='anonymous', perm=MockPerm())
tag_system.delete_tags(req, page.resource)