def get_occurrences(self, start, end, hide_hidden=True):
        """
        returns a list of occurrences between the datetimes ``start`` and ``end``.
        Includes all of the exceptional Occurrences.
        """
        
        start = datetimeify(start)
        end = datetimeify(end)
        
        exceptional_occurrences = self.occurrences.all()
        occ_replacer = OccurrenceReplacer(exceptional_occurrences)
        occurrences = self._get_occurrence_list(start, end)
        final_occurrences = []
        for occ in occurrences:
            # replace occurrences with their exceptional counterparts
            if occ_replacer.has_occurrence(occ):
                p_occ = occ_replacer.get_occurrence(occ)
                # ...but only if they're not hidden and you want to see them
                if not (hide_hidden and p_occ.hide_from_lists):
                    # ...but only if they are within this period
                    if p_occ.start < end and p_occ.end >= start:
                        final_occurrences.append(p_occ)
            else:
              final_occurrences.append(occ)
        # then add exceptional occurrences which originated outside of this period but now
        # fall within it
        final_occurrences += occ_replacer.get_additional_occurrences(start, end)
		
        return final_occurrences
    def get_occurrences(self, start, end, hide_hidden=True):
        """
        returns a list of occurrences between the datetimes ``start`` and ``end``.
        Includes all of the exceptional Occurrences.
        """

        start = datetimeify(start)
        end = datetimeify(end)

        exceptional_occurrences = self.occurrences.all()
        occ_replacer = OccurrenceReplacer(exceptional_occurrences)
        occurrences = self._get_occurrence_list(start, end)
        final_occurrences = []
        for occ in occurrences:
            # replace occurrences with their exceptional counterparts
            if occ_replacer.has_occurrence(occ):
                p_occ = occ_replacer.get_occurrence(occ)
                # ...but only if they're not hidden and you want to see them
                if not (hide_hidden and p_occ.hide_from_lists):
                    # ...but only if they are within this period
                    if p_occ.start < end and p_occ.end >= start:
                        final_occurrences.append(p_occ)
            else:
                final_occurrences.append(occ)
        # then add exceptional occurrences which originated outside of this period but now
        # fall within it
        final_occurrences += occ_replacer.get_additional_occurrences(
            start, end)

        return final_occurrences
Beispiel #3
0
 def occurrences_after(self, after=None):
     """
     returns a generator that produces occurrences after the datetime
     ``after``.	Includes all of the exceptional Occurrences.
     """
     occ_replacer = OccurrenceReplacer(self.occurrence_set.all())
     generator = self._occurrences_after_generator(after)
     while True:
         next = generator.next()
         yield occ_replacer.get_occurrence(next)
 def occurrences_after(self, after=None):
     """
     returns a generator that produces occurrences after the datetime
     ``after``.	Includes all of the exceptional Occurrences.
     
     TODO: this doesn't bring in occurrences that were originally outside this date range, but now fall within it (or vice versa).
     """
     occ_replacer = OccurrenceReplacer(self.occurrence_set.all())
     generator = self._occurrences_after_generator(after)
     while True:
         next = generator.next()
         yield occ_replacer.get_occurrence(next)
 def occurrences_after(self, after=None):
     """
     returns a generator that produces occurrences after the datetime
     ``after``.	Includes all of the exceptional Occurrences.
     
     TODO: this doesn't bring in occurrences that were originally outside this date range, but now fall within it (or vice versa).
     """
     occ_replacer = OccurrenceReplacer(self.occurrence_set.all())
     generator = self._occurrences_after_generator(after)
     while True:
         next = generator.next()
         yield occ_replacer.get_occurrence(next)
Beispiel #6
0
    def get_occurrences(self, start, end):
        exceptional_occurrences = self.occurrences.all()
        occ_replacer = OccurrenceReplacer(exceptional_occurrences)
        occurrences = self._get_occurrence_list(start, end)
        final_occurrences = []
        for occ in occurrences:
            # replace occurrences with their exceptional counterparts
            if occ_replacer.has_occurrence(occ):
                p_occ = occ_replacer.get_occurrence(occ)
                # ...but only if they are within this period
                if p_occ.start < end and p_occ.end >= start:
                    final_occurrences.append(p_occ)
            else:
              final_occurrences.append(occ)
        # then add exceptional occurrences which originated outside of this period but now
        # fall within it
        final_occurrences += occ_replacer.get_additional_occurrences(start, end)

        # import pdb; pdb.set_trace()
        return final_occurrences