Commits

Anonymous committed 73838fb

Applied the icalendar_roadmap_bug_r5887.patch from ticket #5143, contributed by Justin Francis. In addition, I added a call to `apply_ticket_permissions` to restrict the list of tickets that can actually be viewed by the user.

I also took this opportunity to add Justin to the THANKS file, as he also contributed the new milestone interface ITicketGroupStatsProvider (see r4150).

Comments (0)

Files changed (2)

  * Wesley Crucius                 wcrucius@sandc.com
  * dju'                           
  * Daragh Fitzpatrick             Daragh@i2i-Tech.com
+ * Justin Francis
  * Markus Fuchs                   
  * Eric Gillespie                 epg@netbsd.org
  * Matthew Good                   trac@matt-good.net

trac/ticket/roadmap.py

         for milestone in milestones:
             tickets = get_tickets_for_milestone(self.env, db, milestone.name,
                                                 'owner')
-            tickets = apply_ticket_permissions(self.env, req, milestone, tickets)
+            tickets = apply_ticket_permissions(self.env, req, milestone,
+                                               tickets)
             stat = get_ticket_stats(self.stats_provider, tickets)
             stats.append(milestone_stats_data(req, stat, milestone.name))
             #milestone['tickets'] = tickets # for the iCalendar view
         write_prop('X-WR-CALNAME',
                    self.config.get('project', 'name') + ' - ' + _('Roadmap'))
         for milestone in milestones:
-            uid = '<%s/milestone/%s@%s>' % (req.base_path, milestone['name'],
+            uid = '<%s/milestone/%s@%s>' % (req.base_path, milestone.name,
                                             host)
-            if milestone.has_key('due'):
+            due_ts = None
+            if milestone.due:
+            	due_ts = milestone.due.timetuple()
                 write_prop('BEGIN', 'VEVENT')
                 write_prop('UID', uid)
-                write_utctime('DTSTAMP', localtime(milestone['due']))
-                write_date('DTSTART', localtime(milestone['due']))
+                write_utctime('DTSTAMP', due_ts)
+                write_date('DTSTART', due_ts)
                 write_prop('SUMMARY', _('Milestone %(name)s') % {
-                    'name': milestone['name']
+                    'name': milestone.name
                 })
                 write_prop('URL', req.base_url + '/milestone/' +
-                           milestone['name'])
-                if milestone.has_key('description_source'):
-                    write_prop('DESCRIPTION', milestone['description_source'])
+                           milestone.name)
+                if milestone.description:
+                    write_prop('DESCRIPTION', milestone.description)
                 write_prop('END', 'VEVENT')
-            for tkt_id in [ticket['id'] for ticket in milestone['tickets']
+            tickets = get_tickets_for_milestone(self.env, db, milestone.name,
+                                                field='owner')
+            tickets = apply_ticket_permissions(self.env, req, milestone,
+                                               tickets)
+            for tkt_id in [ticket['id'] for ticket in tickets
                            if ticket['owner'] == user]:
                 ticket = Ticket(self.env, tkt_id)
                 write_prop('BEGIN', 'VTODO')
                 write_prop('UID', '<%s/ticket/%s@%s>' % (req.base_path,
                                                          tkt_id, host))
-                if milestone.has_key('due'):
+                if milestone.due:
                     write_prop('RELATED-TO', uid)
-                    write_date('DUE', localtime(milestone['due']))
+                    write_date('DUE', due_ts)
                 write_prop('SUMMARY', _('Ticket #%(num)s: %(summary)s') % {
                     'num': ticket.id, 'summary': ticket['summary']
                 })