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


Python Component.name方法代码示例

本文整理汇总了Python中trac.ticket.model.Component.name方法的典型用法代码示例。如果您正苦于以下问题:Python Component.name方法的具体用法?Python Component.name怎么用?Python Component.name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trac.ticket.model.Component的用法示例。


在下文中一共展示了Component.name方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_no_disown_from_changed_component

# 需要导入模块: from trac.ticket.model import Component [as 别名]
# 或者: from trac.ticket.model.Component import name [as 别名]
    def test_no_disown_from_changed_component(self):
        """
        Verify that a ticket is not disowned when the component is changed to
        a non-assigned component.
        """
        component1 = Component(self.env)
        component1.name = 'test1'
        component1.owner = 'joe'
        component1.insert()

        component2 = Component(self.env)
        component2.name = 'test2'
        component2.owner = ''
        component2.insert()

        ticket = Ticket(self.env)
        ticket['reporter'] = 'santa'
        ticket['summary'] = 'Foo'
        ticket['component'] = 'test1'
        ticket['status'] = 'new'
        tktid = ticket.insert()

        ticket = Ticket(self.env, tktid)
        ticket['component'] = 'test2'
        ticket.save_changes('jane', 'Testing')
        self.assertEqual('joe', ticket['owner'])
开发者ID:zjj,项目名称:trac_hack,代码行数:28,代码来源:model.py

示例2: test_no_disown_from_changed_component

# 需要导入模块: from trac.ticket.model import Component [as 别名]
# 或者: from trac.ticket.model.Component import name [as 别名]
    def test_no_disown_from_changed_component(self):
        """
        Verify that a ticket is not disowned when the component is changed to
        a non-assigned component.
        """
        component1 = Component(self.env)
        component1.name = "test1"
        component1.owner = "joe"
        component1.insert()

        component2 = Component(self.env)
        component2.name = "test2"
        component2.owner = ""
        component2.insert()

        ticket = Ticket(self.env)
        ticket["reporter"] = "santa"
        ticket["summary"] = "Foo"
        ticket["component"] = "test1"
        ticket["status"] = "new"
        tktid = ticket.insert()

        ticket = Ticket(self.env, tktid)
        ticket["component"] = "test2"
        ticket.save_changes("jane", "Testing")
        self.assertEqual("joe", ticket["owner"])
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:28,代码来源:model.py

示例3: test_owner_from_changed_component

# 需要导入模块: from trac.ticket.model import Component [as 别名]
# 或者: from trac.ticket.model.Component import name [as 别名]
    def test_owner_from_changed_component(self):
        """
        Verify that the owner of a new ticket is updated when the component is
        changed.
        """
        component1 = Component(self.env)
        component1.name = 'test1'
        component1.owner = 'joe'
        component1.insert()

        component2 = Component(self.env)
        component2.name = 'test2'
        component2.owner = 'kate'
        component2.insert()

        ticket = Ticket(self.env)
        ticket['reporter'] = 'santa'
        ticket['summary'] = 'Foo'
        ticket['component'] = 'test1'
        ticket['status'] = 'new'
        tktid = ticket.insert()

        ticket = Ticket(self.env, tktid)
        ticket['component'] = 'test2'
        ticket.save_changes('jane', 'Testing')
        self.assertEqual('kate', ticket['owner'])
开发者ID:zjj,项目名称:trac_hack,代码行数:28,代码来源:model.py

示例4: test_create_and_update

# 需要导入模块: from trac.ticket.model import Component [as 别名]
# 或者: from trac.ticket.model.Component import name [as 别名]
    def test_create_and_update(self):
        component = Component(self.env)
        component.name = 'Test'
        component.insert()

        self.assertEqual([('Test', None, None)], self.env.db_query("""
            SELECT name, owner, description FROM component
            WHERE name='Test'"""))

        # Use the same model object to update the component
        component.owner = 'joe'
        component.update()
        self.assertEqual([('Test', 'joe', None)], self.env.db_query(
            "SELECT name, owner, description FROM component WHERE name='Test'"))
开发者ID:thimalk,项目名称:bloodhound,代码行数:16,代码来源:model.py

示例5: test_create_and_update

# 需要导入模块: from trac.ticket.model import Component [as 别名]
# 或者: from trac.ticket.model.Component import name [as 别名]
    def test_create_and_update(self):
        component = Component(self.env)
        component.name = "Test"
        component.insert()

        cursor = self.db.cursor()
        cursor.execute("SELECT name,owner,description FROM component " "WHERE name='Test'")
        self.assertEqual(("Test", None, None), cursor.fetchone())

        # Use the same model object to update the component
        component.owner = "joe"
        component.update()
        cursor.execute("SELECT name,owner,description FROM component " "WHERE name='Test'")
        self.assertEqual(("Test", "joe", None), cursor.fetchone())
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:16,代码来源:model.py

示例6: test_owner_from_component

# 需要导入模块: from trac.ticket.model import Component [as 别名]
# 或者: from trac.ticket.model.Component import name [as 别名]
    def test_owner_from_component(self):
        """
        Verify that the owner of a new ticket is set to the owner of the
        component.
        """
        component = Component(self.env)
        component.name = 'test'
        component.owner = 'joe'
        component.insert()

        ticket = Ticket(self.env)
        ticket['reporter'] = 'santa'
        ticket['summary'] = 'Foo'
        ticket['component'] = 'test'
        ticket.insert()
        self.assertEqual('joe', ticket['owner'])
开发者ID:zjj,项目名称:trac_hack,代码行数:18,代码来源:model.py

示例7: _add_component

# 需要导入模块: from trac.ticket.model import Component [as 别名]
# 或者: from trac.ticket.model.Component import name [as 别名]
 def _add_component(self, name='test', owner='owner1'):
     component = Component(self.env)
     component.name = name
     component.owner = owner
     component.insert()
开发者ID:pkdevbox,项目名称:trac,代码行数:7,代码来源:default_workflow.py

示例8: _insert_component

# 需要导入模块: from trac.ticket.model import Component [as 别名]
# 或者: from trac.ticket.model.Component import name [as 别名]
 def _insert_component(self, name):
     component = Component(self.env)
     component.name = name
     component.insert()
     return component
开发者ID:Stackato-Apps,项目名称:bloodhound,代码行数:7,代码来源:ticket_search.py

示例9: create_hack

# 需要导入模块: from trac.ticket.model import Component [as 别名]
# 或者: from trac.ticket.model.Component import name [as 别名]
    def create_hack(self, req, data, vars):
        import fcntl

        messages = []
        created = False
        have_lock = False
        lockfile = open(self.lockfile, "w")
        try:
            rv = fcntl.flock(lockfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
            if rv:
                raise TracError('Failed to acquire lock, error: %i' % rv)
            have_lock = True
        except IOError:
            messages.append(
                'A hack is currently being created by another user. '
                'Please wait a few seconds, then click the "Create hack" '
                'button again.'
            )

        if have_lock:
            steps_done = []
            try:
                # Step 1: create repository paths
                from os import popen

                svn_path = 'file://%s' % \
                    self.env.config.get('trac', 'repository_dir')
                svn_path = svn_path.rstrip('/')
                page_name = vars['WIKINAME']
                hack_path = vars['LCNAME']
                paths = [ '%s/%s' % (svn_path, hack_path) ]
                selected_releases = data['selected_releases']
                if isinstance(selected_releases, (basestring, unicode)):
                    selected_releases = [ selected_releases, ]
                for release in selected_releases:
                    if release == 'anyrelease': continue
                    paths.append("%s/%s/%s" % \
                        (svn_path, hack_path, release))

                cmd  = '/usr/bin/op create-hack %s ' % req.authname
                cmd += '"New hack %s, created by %s" ' % \
                        (page_name, req.authname)
                cmd += '%s 2>&1' % ' '.join(paths)
                output = popen(cmd).readlines()
                if output:
                    raise Exception(
                        "Failed to create Subversion paths:\n%s" % \
                            '\n'.join(output)
                        )
                steps_done.append('repository')

                # Step 2: Add permissions
                from svnauthz.model import User, Path, PathAcl

                authz_file = self.env.config.get('trac', 'authz_file')
                authz = AuthzFileReader().read(authz_file)

                svn_path_acl = PathAcl(User(req.authname), r=True, w=True)
                authz.add_path(Path("/%s" % hack_path, acls = [svn_path_acl,]))
                AuthzFileWriter().write(authz_file, authz)
                steps_done.append('permissions')

                # Step 3: Add component
                component = TicketComponent(self.env)
                component.name = page_name
                component.owner = req.authname
                component.insert()
                steps_done.append('component')

                # Step 4: Create wiki page
                template_page = WikiPage(self.env, self.template)
                page = WikiPage(self.env, page_name)
                page.text = Template(template_page.text).substitute(vars)
                page.save(req.authname, 'New hack %s, created by %s' % \
                          (page_name, req.authname), '0.0.0.0')
                steps_done.append('wiki')

                # Step 5: Tag the new wiki page
                res = Resource('wiki', page_name)
                tags = data['tags'].split() + selected_releases + [data['type']]
                TagSystem(self.env).set_tags(req, res, tags)
                steps_done.append('tags')

                rv = fcntl.flock(lockfile, fcntl.LOCK_UN)
                created = True
            except Exception, e:
                try:
                    if 'tags' in steps_done:
                        res = Resource('wiki', page_name)
                        tags = data['tags'].split() + selected_releases
                        TagSystem(self.env).delete_tags(req, res, tags)
                    if 'wiki' in steps_done:
                        WikiPage(self.env, page_name).delete()
                    if 'component' in steps_done:
                        TicketComponent(self.env, page_name).delete()
                    if 'permissions' in steps_done:
                        authz_file = self.env.config.get('trac', 'authz_file')
                        authz = AuthzFileReader().read(authz_file)
                        authz.del_path(Path("/%s" % hack_path))
                        AuthzFileWriter().write(authz_file, authz)
#.........这里部分代码省略.........
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:103,代码来源:web_ui.py


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