• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python ticket.Milestone类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: process_request

    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 req.args.has_key('cancel'):
                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:moreati,项目名称:trac-gitsvn,代码行数:35,代码来源:roadmap.py


示例2: change_milestone

 def change_milestone(self, name_to_change, name=None, description=None):
     milestone = Milestone(self.env, name_to_change)
     if name is not None:
         milestone.name = name
     if description is not None:
         milestone.description = description
     milestone.update()
     return milestone
开发者ID:domaemon,项目名称:bloodhound-qa,代码行数:8,代码来源:base.py


示例3: test_milestone

    def test_milestone(self):
        milestone = Milestone(self.env)
        milestone.name = 'New target date'
        milestone.description = 'Lorem ipsum dolor sit amet'
        milestone.insert()
        so = self._get_so()
        self.assertEquals('%s:milestone:New target date' % self.basename,
                          so.doc_id)
        self.assertEquals('milestone', so.realm),
        self.assertEquals('New target date', so.id)
        self.assertTrue('New target date' in so.title)
        self.assertTrue('Lorem ipsum' in so.title)
        self.assertTrue('Lorem ipsum' in so.oneline)
        self.assertTrue('Lorem ipsum' in so.body)

        milestone.description = 'No latin filler here'
        milestone.due = datetime(2001, 01, 01, tzinfo=utc)
        milestone.update()
        so = self._get_so()
        self.assertEquals('%s:milestone:New target date' % self.basename,
                          so.doc_id)
        self.assertEquals('milestone', so.realm),
        self.assertEquals('New target date', so.id)
        self.assertEquals(milestone.due, so.changed)
        self.assertFalse('Lorem ipsum' in so.body)
        self.assertTrue('No latin filler here' in so.body)
开发者ID:getpenelope,项目名称:fulltextsearchplugin,代码行数:26,代码来源:fulltextsearch.py


示例4: _get_options

 def _get_options(self, field_name):
     """Return a list of options for the given [dynvars] field:
     
      [dynvars]
      myfield.options = value1|value2|value3
     
     If no [dynvars] field is found, a select field is searched
     and its options returned.  For the milestone field, completed
     milestones are omitted.  If no select field is found, then an
     empty list is returned."""
     # look for [dynvars] field
     for key,val in self.env.config.options('dynvars'):
         if key == field_name+'.options':
             return val.split('|')
     
     # handle milestone special - skip completed milestones
     if field_name == 'milestone':
         return [''] + [m.name for m in
                 Milestone.select(self.env, include_completed=False)]
     
     # lookup select field
     for field in TicketSystem(self.env).get_ticket_fields():
         if field['name'] == field_name and 'options' in field:
             return field['options']
     return []
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:25,代码来源:web_ui.py


示例5: test_remove_milestone

 def test_remove_milestone(self):
     test_name = sys._getframe().f_code.co_name
     expected = self.expected_results[test_name]
     ticket = Ticket(self.env)
     ticket.populate({'reporter': 'santa', 'summary': 'Summary line',
                      'description': 'Lorem ipsum dolor sit amet',
                      })
     ticket.insert()
     milestone = Milestone(self.env)
     milestone.name = 'New target date'
     milestone.description = 'Lorem ipsum dolor sit amet'
     milestone.insert()
     self.assertEqual(2, len(self._get_docs()))
     rv, output = self._execute('fulltext remove milestone')
     self.assertEqual(expected, output)
     self.assertEqual(1, len(self._get_docs()))
开发者ID:CGI-define-and-primeportal,项目名称:trac-plugin-solr,代码行数:16,代码来源:admin.py


示例6: _render_editor

    def _render_editor(self, req, db, milestone):
        # Suggest a default due time of 18:00 in the user's timezone
        default_due = datetime.now(req.tz).replace(hour=18, minute=0, second=0,
                                                   microsecond=0)
        if default_due <= datetime.now(utc):
            default_due += timedelta(days=1)
        
        data = {
            'milestone': milestone,
            'datetime_hint': get_datetime_format_hint(),
            '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, db=db)
                          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')

        Chrome(self.env).add_wiki_toolbars(req)
        return 'milestone_edit.html', data, None
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:26,代码来源:roadmap.py


示例7: _render_milestone_list

 def _render_milestone_list(self, req):
     project_id = req.data['project_id']
     milestones = Milestone.select(self.env, project_id, include_completed=True)
     data = {
         'milestones': milestones,
     }
     return 'mdashboard.html', data, None
开发者ID:lexqt,项目名称:EduTracMetrix,代码行数:7,代码来源:mdashboard.py


示例8: create_milestone

 def create_milestone(self, name, due=None, duration=20, db=None):
     """
     Creates a milestone with the given name and due
     date, the latter should be a datetime object
     """
     db, handle_ta = get_db_for_write(self.env, db)
     # Try to load the milestone first
     try:
         m = Milestone(self.env, name=name, db=db)
     except ResourceNotFound:
         # than we create it
         m = Milestone(self.env, db=db)
         m.name = name
         if due is not None and isinstance(due, datetime):
             dueo = due.toordinal() + duration
             m.due = mktime(datetime.fromordinal(dueo).timetuple())
         m.insert()
         if handle_ta:
             try:
                 db.commit()
                 # workaround for the fact that trac in 0.11.1 doesn't set exists correctly...
                 m._old_name = m.name
             except Exception, e:
                 self.env.log.warning(exception_to_unicode(e))
                 db.rollback()
开发者ID:djangsters,项目名称:agilo,代码行数:25,代码来源:test_env_helper.py


示例9: _find_milestones

	def _find_milestones(self):
		"""Return a string list of Milestone names
		
		A smarter approach would return a dictionary of milestones:
		key = name
		value = tuple (name, due, completed, description)
		"""

		return [ "%s" % m.name for m in Milestone.select(self.env) ]
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:9,代码来源:qatracker.py


示例10: process

    def process(self, commit, status, branch):
        self.closestatus = status

        milestones = [m.name for m in Milestone.select(self.env) if m.name != "unknown"]
        if branch.startswith("fixes/"):
            branch = branch[6:]
            milestones = [m for m in milestones if m.startswith(branch)]
        self.milestone = sorted(milestones)[-1]

        msg = commit["message"]
        self.env.log.debug("Processing Commit: %s", msg)
        msg = "%s \n Branch:    %s \n Changeset: %s" % (msg, branch, commit["id"])
        #        author = commit['author']['name']
        author = "Github"
        timestamp = datetime.now(utc)

        cmd_groups = command_re.findall(msg)
        self.env.log.debug("Function Handlers: %s" % cmd_groups)

        tickets = {}
        for cmd, tkts in cmd_groups:
            funcname = self.__class__._supported_cmds.get(cmd.lower(), "")
            self.env.log.debug("Function Handler: %s" % funcname)
            if funcname:
                for tkt_id in ticket_re.findall(tkts):
                    if (branch == "master") or branch.startswith("fixes/"):
                        tickets.setdefault(tkt_id, []).append(getattr(self, funcname))
        #                    disable this stuff for now, it causes duplicates on merges
        #                    proper implementation of this will require tracking commit hashes
        #                    else:
        #                        tickets.setdefault(tkt_id, []).append(self._cmdRefs)

        for tkt_id, cmds in tickets.iteritems():
            try:
                db = self.env.get_db_cnx()

                ticket = Ticket(self.env, int(tkt_id), db)
                for cmd in cmds:
                    cmd(ticket)

                # determine sequence number...
                cnum = 0
                tm = TicketModule(self.env)
                for change in tm.grouped_changelog_entries(ticket, db):
                    if change["permanent"]:
                        cnum += 1

                ticket.save_changes(author, msg, timestamp, db, cnum + 1)
                db.commit()

                tn = TicketNotifyEmail(self.env)
                tn.notify(ticket, newticket=0, modtime=timestamp)
            except Exception, e:
                import traceback

                traceback.print_exc(file=sys.stderr)
开发者ID:nilknarf0,项目名称:extras,代码行数:56,代码来源:hook.py


示例11: _get_milestone

 def _get_milestone(self, req):
     """Extract the milestone from the referer url.  If not found then
     return the current milestone."""
     path = req.environ.get('HTTP_REFERER','')
     milestone_re = re.compile(r"/milestone/(?P<milestone>[^?]+)")
     match = milestone_re.search(path)
     if match:
         name = urllib.unquote(match.groupdict()['milestone'])
         for m in Milestone.select(self.env, include_completed=True):
             if m.name == name:
                 return m
         else:
             raise Exception("Milestone %s not found" % name)
     else:
         # milestone not found in url, so assume current milestone
         for m in Milestone.select(self.env, include_completed=False):
             return m
         else:
             raise Exception("No provided or current milestone")
     return None
开发者ID:svn2github,项目名称:sumstatsplugin,代码行数:20,代码来源:web_ui.py


示例12: _render_confirm

    def _render_confirm(self, req, db, milestone):
        req.perm.assert_permission('MILESTONE_DELETE')

        req.hdf['title'] = 'Jalon %s' % milestone.name
        req.hdf['milestone'] = milestone_to_hdf(self.env, db, req, milestone)
        req.hdf['milestone.mode'] = 'delete'

        for idx,other in enumerate(Milestone.select(self.env, False, db)):
            if other.name == milestone.name:
                continue
            req.hdf['milestones.%d' % idx] = other.name
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:11,代码来源:roadmap.py


示例13: _render_confirm

    def _render_confirm(self, req, db, milestone):
        req.perm(milestone.resource).require('MILESTONE_DELETE')

        milestones = [m for m in Milestone.select(self.env, db=db)
                      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:wiraqutra,项目名称:photrackjp,代码行数:12,代码来源:roadmap.py


示例14: _create_milestone

	def _create_milestone(self, name, duedate, description):
		m = Milestone(self.env)
		m.name = name
		m.description = description
		if duedate:
			if isinstance(duedate, type("")):
				m.due = parse_date(duedate)
			else:
				m.due = duedate
		m.insert()
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:10,代码来源:qatracker.py


示例15: test_can_save_due_date

 def test_can_save_due_date(self):
     # Added when Trac 0.12 was released as the format of the timestamp has changed in 0.12
     milestone = Milestone(self.env)
     milestone.name = 'fnord'
     milestone.insert()
     # in trac 0.11.1, milestone._old_name is not set to "fnord" at
     # insert() time, only on init() or update()
     # so we need to reload the object to be able to run update() on it
     milestone = Milestone(self.env, name='fnord')
     
     expected_time = now().replace(microsecond=0)
     milestone.due = expected_time
     milestone.completed = expected_time
     milestone.update()
     
     loaded_milestone = Milestone(self.env, name='fnord')
     self.assert_equals(expected_time, loaded_milestone.due)
     self.assert_equals(expected_time, loaded_milestone.completed)
开发者ID:djangsters,项目名称:agilo,代码行数:18,代码来源:agilomilestone_test.py


示例16: execute

def execute(hdf, txt, env):
    out = StringIO()
    out.write('<ul>\n')
    for milestone in Milestone.select(env, include_completed=False):
        if milestone.due > 0:
            date = format_date(milestone.due)
        else:
            date = Markup('<i>(later)</i>')
        out.write(Markup('<li>%s - <a href="%s">%s</a></li>\n',
                         date, env.href.milestone(milestone.name),
                         milestone.name))
    out.write('</ul>\n')
    return out.getvalue()
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:13,代码来源:PlannedMilestones.py


示例17: testMilestoneRenamePropagatesToSprints

 def testMilestoneRenamePropagatesToSprints(self):
     """Tests that the rename of a Milestone, propagates to the Sprints, this
     is an AgiloMilestone feature"""
     m = Milestone(self.env)
     m.name = 'test_me'
     m.insert()
     s = self.teh.create_sprint('my sprint', milestone=m.name)
     self.assert_equals(m.name, s.milestone)
     # AT: we need to reload the milestone as there is a problem in trac,
     # that the insert is not updating the _old_name, making the update
     # silently fail. I sent a patch for this
     m = Milestone(self.env, m.name)
     m.name = 'test_me_not'
     m.update()
     smm = SprintModelManager(self.env)
     smm.get_cache().invalidate()
     s = smm.get(name=s.name)
     self.assert_equals(m.name, s.milestone)
开发者ID:djangsters,项目名称:agilo,代码行数:18,代码来源:agilomilestone_test.py


示例18: expand_macro

    def expand_macro(self, formatter, name, content):
        
        arg,kwarg = parse_args(content)
        
        includepattern = kwarg.get('include', '')
        #excludepattern = kwarg.get('exclude', '')
        length = int(kwarg.get('max', -1))
        ignorenoduedate = kwarg.get('ignore') == 'noduedate' or None
        
        if length==-1:
            length = None
        
        out = StringIO()
        
        include = re.compile(includepattern)
        #exclude = re.compile(excludepattern)

        milestones = []
        
        for milestone in Milestone.select(self.env, include_completed=False):
            if include.match(milestone.name): # and not exclude.match(milestone.name):
                milestones.append(milestone)
                
        out.write('<ul>\n')
        for milestone in milestones[0:length]:

            if milestone.due:
                #TODO: add one day to tdelta
                tdelta = (to_timestamp(milestone.due) -
                          to_timestamp(datetime.now(formatter.req.tz)))
                if tdelta > 0:
                    date = format_date(milestone.due, '%Y-%m-%d',
                                       formatter.req.tz)
                else:
                    date = None
            elif not ignorenoduedate:
                date = Markup('<i>(Unspecified)</i>')
            else:
                date = None
                
            if date:        
                out.write('<li>%s - <a href="%s">%s</a></li>\n' % 
                          (date, self.env.href.milestone(milestone.name),
                           milestone.name))
            
        out.write('</ul>\n')
        return Markup(out.getvalue())
开发者ID:nyuhuhuu,项目名称:trachacks,代码行数:47,代码来源:PlannedMilestones.py


示例19: process_request

    def process_request(self, req):
        req.perm.require('MILESTONE_VIEW')

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

        db = self.env.get_db_cnx()
        milestones = Milestone.select(self.env, 'completed' in show, db)
        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, db, milestone.name,
                                                '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, db, 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', 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:wiraqutra,项目名称:photrackjp,代码行数:47,代码来源:roadmap.py


示例20: process_request

   def process_request(self, req, chrome, projects):
        milestones = []
        stats = []
        for project in projects:
            env = project["env"]
            for m in Milestone.select(env, False, env.get_db_cnx()):
                req.href = env.href
                milestone = milestone_to_hdf(env, env.get_db_cnx(), req, m)
                milestone['project'] = project
                milestones.append(milestone)

        milestones.sort(milestone_cmp)

        idx = 0
        for m in milestones:
            project = m['project']
            env = project['env']
            milestone_name = unescape(m['name']) # Kludge
            prefix = 'roadmap.milestones.%d.' % idx
            tickets = get_tickets_for_milestone(env, env.get_db_cnx(), milestone_name,
                                                'owner')
            stat = calc_ticket_stats(tickets)
            stats.append({'stats': stat})
            m['queries'] = {}
            for k, v in get_query_links(env, milestone_name).items():
                m['queries'][k] = v
            m['tickets'] = tickets # for the iCalendar view
            idx += 1

            # make milestone names unique
            m["name"] = project["name"] + " " + m["name"]

        data = {
            'milestones': milestones,
            'milestone_stats': stats
        }

        data["chrome.nav.mainnav.roadmap.active"] = 1
        data['title'] = _('Roadmap')
        template_dir = os.path.dirname(__file__) + '/templates/'
        chrome.populate_data(req, data)
        output = chrome.render_template(req, template_dir + "roadmap.html", data)
        req.session.save()
        req.send(output, 'text/html')
开发者ID:jun66j5,项目名称:TraM,代码行数:44,代码来源:roadmap.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ticket.Ticket类代码示例发布时间:2022-05-27
下一篇:
Python notification.parse_smtp_message函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap