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


Python Milestone.name方法代码示例

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


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

示例1: milestone_setup

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import name [as 别名]
def milestone_setup(tc):
    from datetime import datetime
    from trac.util.datefmt import utc
    boo = Milestone(tc.env)
    boo.name = 'boo'
    boo.completed = boo.due = None
    boo.insert()
    roo = Milestone(tc.env)
    roo.name = 'roo'
    roo.completed = datetime.now(utc)
    roo.due = None
    roo.insert()
开发者ID:dafrito,项目名称:trac-mirror,代码行数:14,代码来源:wikisyntax.py

示例2: process_request

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import name [as 别名]
    def process_request(self, req):
        milestone_id = req.args.get('id')
        req.perm('milestone', milestone_id).require('MILESTONE_VIEW')

        add_link(req, 'up', req.href.roadmap(), _('Roadmap'))

        action = req.args.get('action', 'view')
        try:
            milestone = Milestone(self.env, milestone_id)
        except ResourceNotFound:
            if 'MILESTONE_CREATE' not in req.perm('milestone', milestone_id):
                raise
            milestone = Milestone(self.env, None)
            milestone.name = milestone_id
            action = 'edit' # rather than 'new' so that it works for POST/save

        if req.method == 'POST':
            if 'cancel' in req.args:
                if milestone.exists:
                    req.redirect(req.href.milestone(milestone.name))
                else:
                    req.redirect(req.href.roadmap())
            elif action == 'edit':
                return self._do_save(req, milestone)
            elif action == 'delete':
                self._do_delete(req, milestone)
        elif action in ('new', 'edit'):
            return self._render_editor(req, milestone)
        elif action == 'delete':
            return self._render_confirm(req, milestone)

        if not milestone.name:
            req.redirect(req.href.roadmap())

        return self._render_view(req, milestone)
开发者ID:exocad,项目名称:exotrac,代码行数:37,代码来源:roadmap.py

示例3: test_update_milestone_without_name

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import name [as 别名]
    def test_update_milestone_without_name(self):
        cursor = self.db.cursor()
        cursor.execute("INSERT INTO milestone (name) VALUES ('Test')")
        cursor.close()

        milestone = Milestone(self.env, 'Test')
        milestone.name = None
        self.assertRaises(TracError, milestone.update)
开发者ID:zjj,项目名称:trac_hack,代码行数:10,代码来源:model.py

示例4: test_create_milestone

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

        cursor = self.db.cursor()
        cursor.execute("SELECT name,due,completed,description FROM milestone "
                       "WHERE name='Test'")
        self.assertEqual(('Test', 0, 0, ''), cursor.fetchone())
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:11,代码来源:model.py

示例5: test_rename_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import name [as 别名]
    def test_rename_milestone(self):
        milestone = Milestone(self.env)
        milestone.name = "OldName"
        milestone.insert()

        attachment = Attachment(self.env, "milestone", "OldName")
        attachment.insert("foo.txt", StringIO(), 0, 1)

        milestone = Milestone(self.env, "OldName")
        milestone.name = "NewName"
        milestone.update()

        self.assertRaises(ResourceNotFound, Milestone, self.env, "OldName")
        self.assertEqual("NewName", Milestone(self.env, "NewName").name)

        attachments = Attachment.select(self.env, "milestone", "OldName")
        self.assertRaises(StopIteration, attachments.next)
        attachments = Attachment.select(self.env, "milestone", "NewName")
        self.assertEqual("foo.txt", attachments.next().filename)
        self.assertRaises(StopIteration, attachments.next)
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:22,代码来源:model.py

示例6: test_rename_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import name [as 别名]
    def test_rename_milestone(self):
        milestone = Milestone(self.env)
        milestone.name = 'OldName'
        milestone.insert()
        
        attachment = Attachment(self.env, 'milestone', 'OldName')
        attachment.insert('foo.txt', StringIO(), 0, 1)
        
        milestone = Milestone(self.env, 'OldName')
        milestone.name = 'NewName'
        milestone.update()
        
        self.assertRaises(ResourceNotFound, Milestone, self.env, 'OldName')
        self.assertEqual('NewName', Milestone(self.env, 'NewName').name)

        attachments = Attachment.select(self.env, 'milestone', 'OldName')
        self.assertRaises(StopIteration, attachments.next)
        attachments = Attachment.select(self.env, 'milestone', 'NewName')
        self.assertEqual('foo.txt', attachments.next().filename)
        self.assertRaises(StopIteration, attachments.next)
开发者ID:zjj,项目名称:trac_hack,代码行数:22,代码来源:model.py

示例7: milestone_setup

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import name [as 别名]
def milestone_setup(tc):
    boo = Milestone(tc.env)
    boo.name = 'boo'
    boo.completed = boo.due = None
    boo.insert()
    roo = Milestone(tc.env)
    roo.name = 'roo'
    roo.completed = dt_past
    roo.due = None
    roo.insert()
    woo = Milestone(tc.env)
    woo.name = 'woo'
    woo.completed = None
    woo.due = dt_future
    woo.insert()
    zoo = Milestone(tc.env)
    zoo.name = 'zoo'
    zoo.completed = None
    zoo.due = dt_past
    zoo.insert()
开发者ID:exocad,项目名称:exotrac,代码行数:22,代码来源:wikisyntax.py

示例8: ticket_changed

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import name [as 别名]
 def ticket_changed(self, ticket, comment, author, old_values):
     old_summary = old_values.get('summary')
     if ticket['type']==milestone_ticket_type \
         and old_summary \
         and ticket['summary'] != old_summary:
             try:
                 milestone = Milestone(self.env, old_summary)
                 if milestone.exists:
                     milestone.name = ticket['summary']
                     milestone.update()
             except ResourceNotFound:
                 pass
开发者ID:esogs,项目名称:IttecoTracPlugin,代码行数:14,代码来源:roadmap.py

示例9: test_create_and_update_milestone

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

        cursor = self.db.cursor()
        cursor.execute("SELECT name,due,completed,description FROM milestone " "WHERE name='Test'")
        self.assertEqual(("Test", 0, 0, ""), cursor.fetchone())

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

示例10: test_update_milestone_update_tickets

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import name [as 别名]
    def test_update_milestone_update_tickets(self):
        self.env.db_transaction("INSERT INTO milestone (name) VALUES ('Test')")

        tkt1 = Ticket(self.env)
        tkt1.populate({'summary': 'Foo', 'milestone': 'Test'})
        tkt1.insert()
        tkt2 = Ticket(self.env)
        tkt2.populate({'summary': 'Bar', 'milestone': 'Test'})
        tkt2.insert()

        milestone = Milestone(self.env, 'Test')
        milestone.name = 'Testing'
        milestone.update()

        self.assertEqual('Testing', Ticket(self.env, tkt1.id)['milestone'])
        self.assertEqual('Testing', Ticket(self.env, tkt2.id)['milestone'])
开发者ID:thimalk,项目名称:bloodhound,代码行数:18,代码来源:model.py

示例11: testBacklogForMultipleSprint

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import name [as 别名]
 def testBacklogForMultipleSprint(self):
     """Tests a Backlog associated to a Sprint with multiple sprints"""
     # Creates a Milestone
     m = Milestone(self.env)
     m.name = "Milestone 1"
     m.insert()
     # Create 2 Sprints
     sprint1 = self.teh.create_sprint(
                      name="Sprint 1", 
                      start=to_datetime(t=None), 
                      duration=20,
                      milestone=m.name)
     sprint2 = self.teh.create_sprint( 
                      name="Sprint 2", 
                      start=to_datetime(t=None), 
                      duration=20,
                      milestone=m.name)
     # Create some tickets
     s1 = self.teh.create_ticket(Type.USER_STORY, 
                                 props={Key.STORY_POINTS: '3', 
                                        Key.SPRINT: sprint1.name})
     self.assert_true(s1.link_to(self.teh.create_ticket(Type.TASK, 
                                                        props={Key.REMAINING_TIME: '4',
                                                               Key.SPRINT: sprint1.name})))
     self.assert_true(s1.link_to(self.teh.create_ticket(Type.TASK,
                                                        props={Key.REMAINING_TIME: '8',
                                                               Key.SPRINT: sprint1.name})))
     self.assert_true(s1.link_to(self.teh.create_ticket(Type.TASK, 
                                                        props={Key.REMAINING_TIME: '4'})))
     s2 = self.teh.create_ticket(Type.USER_STORY, props={Key.STORY_POINTS: '5', 
                                                         Key.SPRINT: sprint2.name})
     self.assert_true(s2.link_to(self.teh.create_ticket(Type.TASK, 
                                                        props={Key.REMAINING_TIME: '2',
                                                               Key.SPRINT: sprint2.name})))
     self.assert_true(s2.link_to(self.teh.create_ticket(Type.TASK, 
                                                        props={Key.REMAINING_TIME: '3'})))
     # Creates the Backlog bound to the Sprint
     backlog = BacklogConfiguration(self.env, name="Sprint-Backlog", type=BacklogType.SPRINT)
     backlog.ticket_types = [Type.USER_STORY, Type.TASK]
     backlog.save()
     # The Backlog should contains only the items planned for the Sprint, and with parents
     # planned for the Sprint too
     backlog1 =  self.bmm.get(name="Sprint-Backlog", scope=sprint1.name)
     self.assert_length(3, backlog1)
     backlog2 =  self.bmm.get(name="Sprint-Backlog", scope=sprint2.name)
     self.assert_length(2, backlog2)
开发者ID:djangsters,项目名称:agilo,代码行数:48,代码来源:backlog_test.py

示例12: test_create_and_update_milestone

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

        self.assertEqual([('Test', 0, 0, '')], self.env.db_query("""
            SELECT name, due, completed, description FROM milestone
            WHERE name='Test'
            """))

        # Use the same model object to update the milestone
        milestone.description = 'Some text'
        milestone.update()
        self.assertEqual([('Test', 0, 0, 'Some text')], self.env.db_query("""
            SELECT name, due, completed, description FROM milestone
            WHERE name='Test'
            """))
开发者ID:thimalk,项目名称:bloodhound,代码行数:19,代码来源:model.py

示例13: test_get_ticket_fields_milestone_rename

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import name [as 别名]
    def test_get_ticket_fields_milestone_rename(self):
        """Cached ticket fields are updated when milestone is renamed."""
        fields = self.ticket_system.get_ticket_fields()
        milestone_field = self._get_ticket_field('milestone')
        m2 = Milestone(self.env, 'milestone2')
        m2.name = 'milestone5'

        m2.update()
        updated_fields = self.ticket_system.get_ticket_fields()
        updated_milestone_field = self._get_ticket_field('milestone')

        self.assertNotEqual(fields, updated_fields)
        self.assertEqual(['milestone1', 'milestone2',
                          'milestone3', 'milestone4'],
                         milestone_field['options'])
        self.assertEqual(['milestone1', 'milestone3',
                          'milestone4', 'milestone5'],
                         updated_milestone_field['options'])
开发者ID:pkdevbox,项目名称:trac,代码行数:20,代码来源:api.py

示例14: test_update_milestone_update_tickets

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import name [as 别名]
    def test_update_milestone_update_tickets(self):
        cursor = self.db.cursor()
        cursor.execute("INSERT INTO milestone (name) VALUES ('Test')")
        cursor.close()

        tkt1 = Ticket(self.env)
        tkt1.populate({'summary': 'Foo', 'milestone': 'Test'})
        tkt1.insert()
        tkt2 = Ticket(self.env)
        tkt2.populate({'summary': 'Bar', 'milestone': 'Test'})
        tkt2.insert()

        milestone = Milestone(self.env, 'Test')
        milestone.name = 'Testing'
        milestone.update()

        self.assertEqual('Testing', Ticket(self.env, tkt1.id)['milestone'])
        self.assertEqual('Testing', Ticket(self.env, tkt2.id)['milestone'])
开发者ID:zjj,项目名称:trac_hack,代码行数:20,代码来源:model.py

示例15: task

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import name [as 别名]
 def task(add):
     """the thread task - either we are discovering or adding events"""
     with lock:
         env = ProductEnvironment(self.global_env,
                                  self.default_product)
         if add:
             name = 'milestone_from_' + threading.current_thread().name
             milestone = Milestone(env)
             milestone.name = name
             milestone.insert()
         else:
             # collect the names of milestones reported by Milestone and
             # directly from the db - as sets to ease comparison later
             results.append({
                 'from_t': set([m.name for m in Milestone.select(env)]),
                 'from_db': set(
                     [v[0] for v in self.env.db_query(
                         "SELECT name FROM milestone")])})
开发者ID:mohsadki,项目名称:dargest,代码行数:20,代码来源:model.py


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