예제 #1
0
    def create_sprint(self, name, start=None, end=None, duration=20,
                      milestone=None, team=None):
        """Creates a Sprint for the given milestone, if doesn't exists, first
        it creates a Milestone"""
        # If the start day is set to today, the sprint will
        # normalize it to 9:00am of the start day and all the tests
        # will fail, till 9:00am in the morning...
        if start is None:
            # we set hours to 0 so will be normalized to 9am at any
            # time of the day, when running tests.
            start = (now(tz=utc) - timedelta(days=3)).replace(hour=0)
        if milestone is None:
            milestone = self.create_milestone('Milestone for %s' % name)
        # It should automatically load the existing Sprint if already there
        if isinstance(milestone, Milestone):
            milestone = milestone.name
        sprint_controller = SprintController(self.env)
        if start is not None:
            start = shift_to_utc(start)
        if end is not None:
            end = shift_to_utc(end)
        create_sprint_command = SprintController.CreateSprintCommand(self.env, name=name, start=start,
                                                                     end=end, duration=duration, milestone=milestone)
        create_sprint_command.native = True
        sprint = sprint_controller.process_command(create_sprint_command)

        assert sprint is not None
        if team is not None:
            if isinstance(team, basestring):
                team = self.create_team(name=team)
            sprint.team = team
            sprint.save()
        return sprint
예제 #2
0
 def _parse_date_value(self, req, a_formatted_date):
     """Returns the datetime shifted to UTC timezone for the given
     formatted date."""
     if a_formatted_date:
         the_datetime = datefmt.parse_date(a_formatted_date, tzinfo=req.tz)
         the_datetime = days_time.shift_to_utc(the_datetime)
         return the_datetime
예제 #3
0
파일: view.py 프로젝트: djangsters/agilo
 def _parse_date_value(self, req, a_formatted_date):
     """Returns the datetime shifted to UTC timezone for the given
     formatted date."""
     if a_formatted_date:
         the_datetime = datefmt.parse_date(a_formatted_date, 
                                           tzinfo=req.tz)
         the_datetime = days_time.shift_to_utc(the_datetime)
         return the_datetime
예제 #4
0
    def create_sprint(self,
                      name,
                      start=None,
                      end=None,
                      duration=20,
                      milestone=None,
                      team=None):
        """Creates a Sprint for the given milestone, if doesn't exists, first
        it creates a Milestone"""
        # If the start day is set to today, the sprint will
        # normalize it to 9:00am of the start day and all the tests
        # will fail, till 9:00am in the morning...
        if start is None:
            # we set hours to 0 so will be normalized to 9am at any
            # time of the day, when running tests.
            start = (now(tz=utc) - timedelta(days=3)).replace(hour=0)
        if milestone is None:
            milestone = self.create_milestone('Milestone for %s' % name)
        # It should automatically load the existing Sprint if already there
        if isinstance(milestone, Milestone):
            milestone = milestone.name
        sprint_controller = SprintController(self.env)
        if start is not None:
            start = shift_to_utc(start)
        if end is not None:
            end = shift_to_utc(end)
        create_sprint_command = SprintController.CreateSprintCommand(
            self.env,
            name=name,
            start=start,
            end=end,
            duration=duration,
            milestone=milestone)
        create_sprint_command.native = True
        sprint = sprint_controller.process_command(create_sprint_command)

        assert sprint is not None
        if team is not None:
            if isinstance(team, basestring):
                team = self.create_team(name=team)
            sprint.team = team
            sprint.save()
        return sprint