def _get_occurrences_helper(self, occ_list, limit=7): """For many occurrences we limit the amount of occurrences to display. That is, this method returns the first 6 (limit) occurrences and the last occurrence in the list. :param occ_list: The list of occurrences returned from IRecurrenceSupport :type occ_list: list :param limit: optional, defaults to 7 :type limit: integer :rtype: tuple of (list of events, last item of occ_list) """ events = [] tail = None if occ_list: occurrences = occ_list[:limit] occurrences.append(occ_list.pop()) many = len(occ_list) > limit for occ in occurrences: acc = IEventAccessor(occ) display = prepare_for_display( self.context, acc.start, acc.end, acc.whole_day) display.update({'url': acc.context.absolute_url()}) events.append(display) tail = events and events.pop() or None tail = tail if many else None return (events, tail)
def date_for_display(self): display = prepare_for_display( self.context, self.data.start, self.data.end, self.data.whole_day) display.update({'url': self.data.context.absolute_url()}) return display