Edgewall Software

Ticket #2259: trac_ticket_r2659.patch

File trac_ticket_r2659.patch, 1.2 KB (added by trac@…, 19 years ago)

patch for notification only. against r2659

  • trac/attachment.py

     
    2626from trac.core import *
    2727from trac.env import IEnvironmentSetupParticipant
    2828from trac.mimeview import *
     29from trac.Notify import TicketNotifyEmail
     30from trac.ticket import Ticket
    2931from trac.web import IRequestHandler
    3032from trac.web.chrome import add_link, add_stylesheet, INavigationContributor
    3133from trac.wiki import IWikiSyntaxProvider
     
    331333            except TracError:
    332334                pass # don't worry if there's nothing to replace
    333335            attachment.filename = None
     336        now = time.time()
    334337        attachment.insert(filename, upload.file, size)
     338        if attachment.parent_type == 'ticket':
     339            tn = TicketNotifyEmail(self.env)
     340            # before we can do this, we have to get the ticket
     341            # that the attachment will modify
     342            ticket = Ticket(self.env, tkt_id=attachment.parent_id)
     343            tn.notify(ticket, newticket=False, modtime=now)
     344           
    335345
    336346        # Redirect the user to the newly created attachment
    337347        req.redirect(attachment.href())