Index: trac/attachment.py =================================================================== --- trac/attachment.py (revision 2659) +++ trac/attachment.py (working copy) @@ -26,6 +26,8 @@ from trac.core import * from trac.env import IEnvironmentSetupParticipant from trac.mimeview import * +from trac.Notify import TicketNotifyEmail +from trac.ticket import Ticket from trac.web import IRequestHandler from trac.web.chrome import add_link, add_stylesheet, INavigationContributor from trac.wiki import IWikiSyntaxProvider @@ -331,7 +333,15 @@ except TracError: pass # don't worry if there's nothing to replace attachment.filename = None + now = time.time() attachment.insert(filename, upload.file, size) + if attachment.parent_type == 'ticket': + tn = TicketNotifyEmail(self.env) + # before we can do this, we have to get the ticket + # that the attachment will modify + ticket = Ticket(self.env, tkt_id=attachment.parent_id) + tn.notify(ticket, newticket=False, modtime=now) + # Redirect the user to the newly created attachment req.redirect(attachment.href())