happenings/utils/handlers.py
def _handle_single_chunk(self, event):
        """
        This handles either a non-repeating event chunk, or the first
        month of a repeating event chunk.
        """
        if not event.starts_same_month_as(self.month) and not \
                event.repeats('NEVER'):
            # no repeating chunk events if we're not in it's start month
            return

        # add the events into an empty defaultdict. This is better than passing
        # in self.count, which we don't want to make another copy of because it
        # could be very large.
        mycount = defaultdict(list)
        r = Repeater(
            mycount, self.year, self.month, day=event.l_start_date.day,
            end_repeat=event.end_repeat, event=event, count_first=True,
            end_on=event.l_end_date.day, num=1
        )

        if event.starts_same_month_as(self.month):
            if not event.ends_same_month_as(self.month):
                # The chunk event starts this month,
                # but does NOT end this month
                r.end_on = None
        else:
            # event chunks can be maximum of 7 days, so if an event chunk
            # didn't start this month, we know it will end this month.
            r.day = 1
        r.repeat()
        # now we add in the events we generated to self.count
        for k, v in r.count.items():
            self.count[k].extend(v)
def _handle_single_chunk(self, event):
        """
        This handles either a non-repeating event chunk, or the first
        month of a repeating event chunk.
        """
        if not event.starts_same_month_as(self.month) and not \
                event.repeats('NEVER'):
            # no repeating chunk events if we're not in it's start month
            return

        # add the events into an empty defaultdict. This is better than passing
        # in self.count, which we don't want to make another copy of because it
        # could be very large.
        mycount = defaultdict(list)
        r = Repeater(
            mycount, self.year, self.month, day=event.l_start_date.day,
            end_repeat=event.end_repeat, event=event, count_first=True,
            end_on=event.l_end_date.day, num=1
        )

        if event.starts_same_month_as(self.month):
            if not event.ends_same_month_as(self.month):
                # The chunk event starts this month,
                # but does NOT end this month
                r.end_on = None
        else:
            # event chunks can be maximum of 7 days, so if an event chunk
            # didn't start this month, we know it will end this month.
            r.day = 1
        r.repeat()
        # now we add in the events we generated to self.count
        for k, v in r.count.items():
            self.count[k].extend(v)
This handles either a non-repeating event chunk, or the first
        month of a repeating event chunk.