本文整理汇总了Python中tractags.api.TagSystem.add_tags方法的典型用法代码示例。如果您正苦于以下问题:Python TagSystem.add_tags方法的具体用法?Python TagSystem.add_tags怎么用?Python TagSystem.add_tags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tractags.api.TagSystem
的用法示例。
在下文中一共展示了TagSystem.add_tags方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: user_created
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import add_tags [as 别名]
def user_created(self, user, password):
req = FakeRequest(self.env, user)
resource = Resource('wiki', user)
tag_system = TagSystem(self.env)
tag_system.add_tags(req, resource, ['user',])
page = WikiPage(self.env, user)
page.text = '''= %(user)s =\n\n[[ListTagged(%(user)s)]]\n''' % {'user' : user}
page.save(user, 'New user %s registered' % user, None)
self.env.log.debug("New user %s registered" % user)
示例2: screenshot_created
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import add_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)
示例3: screenshot_changed
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import add_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)
示例4: download_created
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import add_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)
示例5: download_created
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import add_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)
示例6: download_changed
# 需要导入模块: from tractags.api import TagSystem [as 别名]
# 或者: from tractags.api.TagSystem import add_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)