(self, anchor)
return (phase, is_new_phase)
Returns a tuple of (phase, new?)
Returns a tuple of (phase, new?)
Returns a tuple of ( phase new? )
def get_or_create_schedule_phase(self, anchor):
        """Returns a tuple of (phase, new?)"""
        if anchor is None or anchor.strip() == '':
            raise ScheduleError(_("You can't create a phase without an anchor property"))

        phase = next((phase for phase in self.get_schedule_phases() if phase.anchor == anchor), None)
        is_new_phase = False

        if phase is None:
            self.schedule_phases.append(SchedulePhase(anchor=anchor))
            # TODO: is there a better way of doing this?
            phase = list(self.get_schedule_phases())[-1]  # get the phase from the module so we know the _parent
            is_new_phase = True

        return (phase, is_new_phase)
def get_or_create_schedule_phase ( self , anchor ) : if anchor is None or anchor . strip ( ) == '' : raise ScheduleError ( _ ( "You can't create a phase without an anchor property" ) ) phase = next ( ( phase for phase in self . get_schedule_phases ( ) if phase . anchor == anchor ) , None ) is_new_phase = False if phase is None : self . schedule_phases . append ( SchedulePhase ( anchor = anchor ) ) # TODO: is there a better way of doing this? phase = list ( self . get_schedule_phases ( ) ) [ - 1 ] # get the phase from the module so we know the _parent is_new_phase = True return ( phase , is_new_phase )