Пример #1
0
    def _get_conflicting_appointment(calendar, X):
        """
        Assuming a conflicting appointment, return the Appointment object
        conflicting with X in calendar.
        """

        #for each appointment in the calendar
        for name, appointment in calendar.iteritems():
            #if any appointment conflicts with new appointment X, they conflict
            if is_appointments_conflicting(appointment, X):
                return appointment

        raise KeyError(str(X) + " does not conflict with any Appointment.") 
Пример #2
0
    def _is_calendar_conflicting(self, X, other_calendar=None):
        """
        Determine if Appointment object X conflicts with some Appointment
        already in the calendar.
        """

        if other_calendar:
            calendar = other_calendar
        else:
            calendar = self._calendar

        #for each appointment in the calendar
        for name, appointment in calendar.iteritems():
            #if any appointment conflicts with new appointment X, they conflict
            if is_appointments_conflicting(appointment, X):
                return True

        return False