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


Python Milestone.select方法代码示例

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


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

示例1: _go_graph

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
 def _go_graph(self, req):
     #search all artifacts.
     artifacts = ArtifactManager.find_all(self.env)
     
     milestones = [m for m in Milestone.select(self.env)
                   if 'MILESTONE_VIEW' in req.perm(m.resource)]
     
     #add artifacts to milestone.
     for m in milestones:
         artifacts_of_m = [artifact for artifact in artifacts
                if artifact.milestone == m.name]
         setattr(m, 'artifacts', artifacts_of_m)
     
     manager = SCMManager(self.env, req)
     nodes = manager.artifacts_to_nodes(artifacts)
     
     roots = manager.get_roots(nodes)
     
     gm = GraphManager(self.env)
     nodes = gm.to_graphnode(roots)
     
     gm.to_s(nodes)
     
     graph = gm.to_graphviz(nodes, milestones)
     
     self.env.log.info('graphviz graph:\n%s' % graph)
     
     data = {'milestones':milestones, 'artifacts':artifacts, 'graph':graph}
     return 'releaseartifactgraph.html', data, None
开发者ID:wadahiro,项目名称:trac-release-artifacts-plugin,代码行数:31,代码来源:web_ui.py

示例2: _render_editor

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
    def _render_editor(self, req, milestone):
        # Suggest a default due time of 18:00 in the user's timezone
        now = datetime.now(req.tz)
        default_due = datetime(now.year, now.month, now.day, 18)
        if now.hour > 18:
            default_due += timedelta(days=1)
        default_due = to_datetime(default_due, req.tz)

        data = {
            'milestone': milestone,
            'datetime_hint': get_datetime_format_hint(req.lc_time),
            'default_due': default_due,
            'milestone_groups': [],
        }

        if milestone.exists:
            req.perm(milestone.resource).require('MILESTONE_MODIFY')
            milestones = [m for m in Milestone.select(self.env)
                          if m.name != milestone.name
                          and 'MILESTONE_VIEW' in req.perm(m.resource)]
            data['milestone_groups'] = group_milestones(milestones,
                'TICKET_ADMIN' in req.perm)
        else:
            req.perm(milestone.resource).require('MILESTONE_CREATE')
            if milestone.name:
                add_notice(req, _("Milestone %(name)s does not exist. You can"
                                  " create it here.", name=milestone.name))

        chrome = Chrome(self.env)
        chrome.add_jquery_ui(req)
        chrome.add_wiki_toolbars(req)
        return 'milestone_edit.html', data, None
开发者ID:exocad,项目名称:exotrac,代码行数:34,代码来源:roadmap.py

示例3: _render_editor

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
    def _render_editor(self, req, milestone):
        data = {
            'milestone': milestone,
            'datetime_hint': get_datetime_format_hint(req.lc_time),
            'default_due': self.get_default_due(req),
            'milestone_groups': [],
        }

        if milestone.exists:
            req.perm(milestone.resource).require('MILESTONE_MODIFY')
            milestones = [m for m in Milestone.select(self.env)
                          if m.name != milestone.name
                          and 'MILESTONE_VIEW' in req.perm(m.resource)]
            data['milestone_groups'] = group_milestones(milestones,
                'TICKET_ADMIN' in req.perm)
            data['num_open_tickets'] = milestone \
                                       .get_num_tickets(exclude_closed=True)
            data['retarget_to'] = self.default_retarget_to
        else:
            req.perm(milestone.resource).require('MILESTONE_CREATE')
            if milestone.name:
                add_notice(req, _("Milestone %(name)s does not exist. You can"
                                  " create it here.", name=milestone.name))

        chrome = Chrome(self.env)
        chrome.add_jquery_ui(req)
        chrome.add_wiki_toolbars(req)
        add_stylesheet(req, 'common/css/roadmap.css')
        return 'milestone_edit.html', data, None
开发者ID:spsoft-RockWang,项目名称:project-_trac,代码行数:31,代码来源:roadmap.py

示例4: select

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
 def select(env, include_completed=True, db=None):
     if not db:
         db = env.get_db_cnx()
         
     milestones = [ StructuredMilestone(env, milestone) \
                     for milestone in Milestone.select(env, include_completed, db)]
     return StructuredMilestone.reorganize(milestones)
开发者ID:esogs,项目名称:IttecoTracPlugin,代码行数:9,代码来源:model.py

示例5: _reindex_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
    def _reindex_milestone(self, realm, feedback, finish_fb):
        resources = Milestone.select(self.env)

        def check(milestone, check):
            return True

        index = self._index_milestone
        return self._index(realm, resources, check, index, feedback, finish_fb)
开发者ID:CGI-define-and-primeportal,项目名称:trac-plugin-solr,代码行数:10,代码来源:fulltextsearch.py

示例6: default_retarget_to

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
 def default_retarget_to(self):
     if self._default_retarget_to and \
        not any(self._default_retarget_to == m.name
                for m in Milestone.select(self.env)):
         self.log.warn('Milestone "%s" does not exist. Update the '
                       '"default_retarget_to" option in the [milestone] '
                       'section of trac.ini', self._default_retarget_to)
     return self._default_retarget_to
开发者ID:spsoft-RockWang,项目名称:project-_trac,代码行数:10,代码来源:roadmap.py

示例7: _modify_roadmap_page

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
 def _modify_roadmap_page(self, req, template, data, content_type,
                          is_active):
     """Insert roadmap.css + products breadcrumb
     """
     add_stylesheet(req, 'dashboard/css/roadmap.css')
     self._add_products_general_breadcrumb(req, template, data,
                                           content_type, is_active)
     data['milestone_list'] = [m.name for m in Milestone.select(self.env)]
     req.chrome['ctxtnav'] = []
开发者ID:mohsadki,项目名称:dargest,代码行数:11,代码来源:theme.py

示例8: test_select_milestones

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
    def test_select_milestones(self):
        cursor = self.db.cursor()
        cursor.executemany("INSERT INTO milestone (name) VALUES (%s)", [("1.0",), ("2.0",)])
        cursor.close()

        milestones = list(Milestone.select(self.env))
        self.assertEqual("1.0", milestones[0].name)
        assert milestones[0].exists
        self.assertEqual("2.0", milestones[1].name)
        assert milestones[1].exists
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:12,代码来源:model.py

示例9: test_select_milestones

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
    def test_select_milestones(self):
        self.env.db_transaction.executemany(
            "INSERT INTO milestone (name) VALUES (%s)",
            [('1.0',), ('2.0',)])

        milestones = list(Milestone.select(self.env))
        self.assertEqual('1.0', milestones[0].name)
        assert milestones[0].exists
        self.assertEqual('2.0', milestones[1].name)
        assert milestones[1].exists
开发者ID:thimalk,项目名称:bloodhound,代码行数:12,代码来源:model.py

示例10: list_view

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
 def list_view(self, req, cat, page):
     data = {
         'view': 'list',
         'sprints': self.sm.select(),
         'format_datetime' : datefmt.format_datetime,
         'date_hint' : datefmt.get_date_format_hint(),
         'datetime_hint' : datefmt.get_datetime_format_hint(),
         'milestones' : [m.name for m in Milestone.select(self.env)],
     }
     data.update(req.args)
     return 'agilo_admin_sprint.html', data
开发者ID:djangsters,项目名称:agilo,代码行数:13,代码来源:admin.py

示例11: _render_confirm

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
    def _render_confirm(self, req, milestone):
        req.perm(milestone.resource).require('MILESTONE_DELETE')

        milestones = [m for m in Milestone.select(self.env)
                      if m.name != milestone.name
                      and 'MILESTONE_VIEW' in req.perm(m.resource)]
        data = {
            'milestone': milestone,
            'milestone_groups': group_milestones(milestones,
                'TICKET_ADMIN' in req.perm)
        }
        return 'milestone_delete.html', data, None
开发者ID:exocad,项目名称:exotrac,代码行数:14,代码来源:roadmap.py

示例12: _go_list

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
 def _go_list(self, req):
     #search all artifacts.
     artifacts = ArtifactManager.find_all(self.env)
     
     milestones = [m for m in Milestone.select(self.env)
                   if 'MILESTONE_VIEW' in req.perm(m.resource)]
     
     #add artifacts to milestone.
     for m in milestones:
         artifacts_of_m = [artifact for artifact in artifacts
                if artifact.milestone == m.name]
         setattr(m, 'artifacts', artifacts_of_m)
     
     data = {'milestones':milestones, 'artifacts':artifacts}        
     return 'releaseartifactgraph.html', data, None
开发者ID:wadahiro,项目名称:trac-release-artifacts-plugin,代码行数:17,代码来源:web_ui.py

示例13: users

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
    def users(self, req):
        """hours for all users"""

        data = { 'hours_format' :  hours_format }

        ### date data
        self.date_data(req, data)

        ### milestone data
        milestone = req.args.get('milestone')
        milestones = Milestone.select(self.env)
        data['milestones'] = milestones

        ### get the hours
        #trachours = TracHoursPlugin(self.env)
        #tickets = trachours.tickets_with_hours()
        hours = get_all_dict(self.env, 
                             "SELECT * FROM ticket_time WHERE time_started >= %s AND time_started < %s",
                             *[int(time.mktime(i.timetuple()))
                               for i in (data['from_date'], data['to_date'])])
        worker_hours = {}
        for entry in hours:
            worker = entry['worker']
            if  worker not in worker_hours:
                worker_hours[worker] = 0

            if milestone:
                if milestone != Ticket(self.env, entry['ticket']).values.get('milestone'):
                    continue

            worker_hours[worker] += entry['seconds_worked']

        worker_hours = [(worker, seconds/3600.)
                        for worker, seconds in 
                        sorted(worker_hours.items())]
        data['worker_hours'] = worker_hours

        if req.args.get('format') == 'csv':
            buffer = StringIO()
            writer = csv.writer(buffer)
            format = '%B %d, %Y'
            title = "Hours for %s" % self.env.project_name
            writer.writerow([title, req.abs_href()])
            writer.writerow([])
            writer.writerow(['From', 'To'])
            writer.writerow([data[i].strftime(format) 
                             for i in 'from_date', 'to_date'])
            if milestone:
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:50,代码来源:web_ui.py

示例14: users

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
    def users(self, req):
        """hours for all users"""

        data = {'hours_format':  hours_format}

        ### date data
        self.date_data(req, data)

        ### milestone data
        milestone = req.args.get('milestone')
        milestones = Milestone.select(self.env)
        data['milestones'] = milestones

        ### get the hours
        #trachours = TracHoursPlugin(self.env)
        #tickets = trachours.tickets_with_hours()
        hours = get_all_dict(self.env, """
            SELECT * FROM ticket_time
            WHERE time_started >= %s AND time_started < %s
            """, *[int(time.mktime(i.timetuple()))
                   for i in (data['from_date'], data['to_date'])])
        worker_hours = {}
        for entry in hours:
            worker = entry['worker']
            if worker not in worker_hours:
                worker_hours[worker] = 0

            if milestone and milestone != \
                    Ticket(self.env, entry['ticket']).values.get('milestone'):
                continue

            worker_hours[worker] += entry['seconds_worked']

        worker_hours = [(worker, seconds/3600.)
                        for worker, seconds in 
                        sorted(worker_hours.items())]
        data['worker_hours'] = worker_hours

        if req.args.get('format') == 'csv':
            req.send(self.export_csv(req, data))

        #add_link(req, 'prev', self.get_href(query, args, context.href),
        #         _('Prev Week'))
        #add_link(req, 'next', self.get_href(query, args, context.href),
        #         _('Next Week'))
        #prevnext_nav(req, _('Prev Week'), _('Next Week'))

        return 'hours_users.html', data, "text/html"
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:50,代码来源:web_ui.py

示例15: process_request

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import select [as 别名]
    def process_request(self, req):
        req.perm.require('ROADMAP_VIEW')

        show = req.args.getlist('show')
        if 'all' in show:
            show = ['completed']

        milestones = Milestone.select(self.env, 'completed' in show)
        if 'noduedate' in show:
            milestones = [m for m in milestones
                          if m.due is not None or m.completed]
        milestones = [m for m in milestones
                      if 'MILESTONE_VIEW' in req.perm(m.resource)]

        stats = []
        queries = []

        for milestone in milestones:
            tickets = get_tickets_for_milestone(
                    self.env, milestone=milestone.name, field='owner')
            tickets = apply_ticket_permissions(self.env, req, tickets)
            stat = get_ticket_stats(self.stats_provider, tickets)
            stats.append(milestone_stats_data(self.env, req, stat,
                                              milestone.name))
            #milestone['tickets'] = tickets # for the iCalendar view

        if req.args.get('format') == 'ics':
            self._render_ics(req, milestones)
            return

        # FIXME should use the 'webcal:' scheme, probably
        username = None
        if req.authname and req.authname != 'anonymous':
            username = req.authname
        icshref = req.href.roadmap(show=show, user=username, format='ics')
        add_link(req, 'alternate', auth_link(req, icshref), _('iCalendar'),
                 'text/calendar', 'ics')

        data = {
            'milestones': milestones,
            'milestone_stats': stats,
            'queries': queries,
            'show': show,
        }
        add_stylesheet(req, 'common/css/roadmap.css')
        return 'roadmap.html', data, None
开发者ID:exocad,项目名称:exotrac,代码行数:48,代码来源:roadmap.py


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