def listTerms(self): first, last = self.terms result = [first] next = getNextTerm(first) while (next is not None and not sameProxiedObjects(result[-1], next)): result.append(next) next = getNextTerm(next) return result
def __call__(self): if (self.event.first is None or self.event.second is None): return # unlinking sections first_term = ITerm(self.event.first) second_term = ITerm(self.event.second) if sameProxiedObjects(first_term, second_term): raise InvalidSectionLinkException( _("Cannot link sections in same term")) if not sameProxiedObjects(ISchoolYear(first_term), ISchoolYear(second_term)): raise InvalidSectionLinkException( _("Cannot link sections in different school years")) if not sameProxiedObjects(getNextTerm(first_term), second_term): raise InvalidSectionLinkException( _("Sections must be in consecutive terms"))