Example #1
0
 def test_do_not_raise_exception_on_edit_in_multienv_with_plain_trac(self):
     plain_trac_env = TestEnvHelper(enable_agilo=False, env_key=self.env_key).env
     # This situation happens due to monkey-patching: The plain trac 
     # environment needs to work with Agilo classes.
     milestone = AgiloMilestone(plain_trac_env)
     milestone.name = 'fnord'
     milestone.insert()
     
     # Must not raise an exception
     milestone.update()
Example #2
0
    def send_backlog_list_data(self, req, data):
        """add to the data array the backlog data necessary to show
        the backlog list"""
        def milestone_options(milestones, selected):
            """
            Return three lists of tuple (milestone_name, selected) for
            the milestones which are:
                - Open with a due date
                - Open without a due date
                - Closed
            """
            open_with_due_date = list()
            open_without_due_date = list()
            closed = list()
            for m in milestones:
                m_list = None
                if m.is_completed:
                    m_list = closed
                elif m.due:
                    m_list = open_with_due_date
                else:
                    m_list = open_without_due_date
                # append the milestone to the list
                m_list.append((m.name, m.name == selected))

            return open_with_due_date, open_without_due_date, closed

        # Maximum items in the pulldown, ordered by status and by time
        # The number is the maximum per status, so 5 closed, 5 running
        # and 5 to start
        MAX_ITEMS = 5

        milestone_list = None
        if data is not None and Action.BACKLOG_VIEW in req.perm:
            data['sprint_list'] = self.running_to_start_closed_sprints(req)
            cmd_list = BacklogController.ListBacklogsCommand(self.env)
            data['backlog_list'] = \
                BacklogController(self.env).process_command(cmd_list)
            s_milestone = SessionScope(req).milestone_name()
            open_due, open, closed = \
                milestone_options(AgiloMilestone.select(self.env), s_milestone)
            milestone_list = [{
                Key.LABEL: _('Open (by Due Date)'),
                Key.OPTIONS: open_due
            }, {
                Key.LABEL: _('Open (no Due Date)'),
                Key.OPTIONS: open
            }, {
                Key.LABEL: _('Closed'),
                Key.OPTIONS: closed[-MAX_ITEMS:]
            }]
            data['milestone_list'] = milestone_list
Example #3
0
    def send_backlog_list_data(self, req, data):
        """add to the data array the backlog data necessary to show
        the backlog list"""
        def milestone_options(milestones, selected):
            """
            Return three lists of tuple (milestone_name, selected) for
            the milestones which are:
                - Open with a due date
                - Open without a due date
                - Closed
            """
            open_with_due_date = list()
            open_without_due_date = list()
            closed = list()
            for m in milestones:
                m_list = None
                if m.is_completed:
                    m_list = closed
                elif m.due:
                    m_list = open_with_due_date
                else:
                    m_list = open_without_due_date
                # append the milestone to the list
                m_list.append((m.name, m.name==selected))

            return open_with_due_date, open_without_due_date, closed

        # Maximum items in the pulldown, ordered by status and by time
        # The number is the maximum per status, so 5 closed, 5 running
        # and 5 to start
        MAX_ITEMS = 5

        milestone_list = None
        if data is not None and Action.BACKLOG_VIEW in req.perm:
            data['sprint_list'] = self.running_to_start_closed_sprints(req)
            cmd_list = BacklogController.ListBacklogsCommand(self.env)
            data['backlog_list'] = \
                BacklogController(self.env).process_command(cmd_list)
            s_milestone = SessionScope(req).milestone_name()
            open_due, open, closed = \
                milestone_options(AgiloMilestone.select(self.env), s_milestone)
            milestone_list = [
                {Key.LABEL: _('Open (by Due Date)'),
                 Key.OPTIONS: open_due},
                {Key.LABEL: _('Open (no Due Date)'),
                 Key.OPTIONS: open},
                {Key.LABEL: _('Closed'),
                 Key.OPTIONS: closed[-MAX_ITEMS:]}]
            data['milestone_list'] = milestone_list