当前位置: 首页>>代码示例>>Python>>正文


Python TagSystem.add_tags方法代码示例

本文整理汇总了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)
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:13,代码来源:web_ui.py

示例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)
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:13,代码来源:tags.py

示例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)
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:16,代码来源:tags.py

示例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)
开发者ID:nagyistoce,项目名称:trac-downloads,代码行数:18,代码来源:tags.py

示例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)
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:19,代码来源:tags.py

示例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)
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:24,代码来源:tags.py


注:本文中的tractags.api.TagSystem.add_tags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。