def gentd(week_idx, day_info): day = day_info['date'] tt = day_info['milestones'] + day_info['tickets'] if len(tt) < 6: ttshow = tt ttall = [] else: ttshow = tt[:4] ttall = tt tdclass = [] if day == today: tdclass.append('today') if is_weekend(day, locale): tdclass.append('weekend') formatted_day = format_date(day, format='long', locale=locale) td = tag.td( class_=' '.join(tdclass), data_for_start_date=day.strftime(start_date_format), data_for_due_date=day.strftime(due_date_format), data_fdate=formatted_day) label = [] if day == today: label.append(tag.span(_("Today"), class_='today')) label.append(tag.span(unicode(day.day), class_=('day normal', 'day')[day == today])) td(tag.div(label)) if ttshow: td(tag.ul([genli(t) for t in ttshow])) if ttall: id = 'calendar-more-%s' % str(day) td(tag.a(_("%d more tickets...") % (len(ttall) - 4), href='#' + id, class_='show-all-list'), tag.div(tag.h4(formatted_day), tag.ul([genli(t) for t in ttall]), class_='ticketcalendar-popup-list', id=id, data_title=format_date(day, locale=locale, format='full'))) return td
def get_list_events(self, tickets, start_date, period): milestones = self._get_milestones() req = self.req if not start_date or not period: start_date = get_today(req.tz) period = 7 locale = self._get_locale() days = [start_date + timedelta(days=i) for i in xrange(period)] tickets = self._filter_tickets(days, tickets, req.tz) milestones = self._filter_milestones(days, milestones, req.tz) events = [{'date': day, 'formatted_date': format_date(day, format='full', locale=locale), 'tickets': tickets[day], 'milestones': milestones[day]} for day in days] return events