Ticket #2259: trac_ticket_r6106.patch
File trac_ticket_r6106.patch, 1.4 KB (added by , 17 years ago) |
---|
-
trac/attachment.py
33 33 from trac.env import IEnvironmentSetupParticipant 34 34 from trac.perm import PermissionError, PermissionSystem, IPermissionPolicy 35 35 from trac.mimeview import * 36 from trac.ticket import Ticket 37 from trac.ticket.notification import TicketNotifyEmail 36 38 from trac.timeline.api import TimelineEvent 37 39 from trac.util import get_reporter_id, create_unique_file, content_disposition 38 40 from trac.util.datefmt import to_timestamp, utc … … 551 553 pass # don't worry if there's nothing to replace 552 554 attachment.filename = None 553 555 attachment.insert(filename, upload.file, size) 556 if attachment.parent_realm == 'ticket': 557 try: 558 tn = TicketNotifyEmail(self.env) 559 # have to get the ticket that the attachment will modify 560 ticket = Ticket(self.env, tkt_id=attachment.parent_id) 561 tn.notify(ticket, newticket=False, modtime=attachment.time) 562 except Exception, e: 563 self.log.exception("Failure sending notification for attachment " 564 "on ticket #%s: %s" % (ticket.id, e)) 554 565 555 566 # Redirect the user to list of attachments (must add a trailing '/') 556 567 req.redirect(context.resource_href('..') + '/')