Changeset 508


Ignore:
Timestamp:
01/11/11 16:43:48 (10 years ago)
Author:
bas
Message:

We now can override the notify function with AlwaysNotifyReport?, see #178,#229

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r506 r508  
    7272     Reported by: Wim Rijks
    7373     Author: Bas van der Vlies
    74    
     74
     75   * Added a notifcation function that always send an email to the reporter if
     76     the ticket is updated via email: closes: #178, #229
     77        - always_notify_reporter : 1 (default: 0)
     78        - notify_reporter_black_list : basv@sara.nl (default: 0)
     79     Author: hju add jochenkuhl dot de
     80     Applied by: Bas van der Vlies
     81
    75821.6.0 (2010-8-10)
    7683   * Fixed an Unicode error in strip_quotes
  • trunk/debian/changelog

    r506 r508  
     1email2trac (2.0.1-2) stable; urgency=low
     2
     3  *  See Changelog
     4
     5 -- Bas van der Vlies <basv@sara.nl>  Tue, 11 Jan 2011 16:39:49 +0100
     6
    17email2trac (2.0.1-1) stable; urgency=low
    28
  • trunk/email2trac.py.in

    r507 r508  
    8484from trac import config as trac_config
    8585
    86 # Some global variables
     86## Some global variables
    8787#
    8888m = None
     89
     90# This is to for the function AlwaysNotifyReporter
     91sender_email = None
    8992
    9093class SaraDict(UserDict.UserDict):
     
    21082111        self.logger.debug('function notify()')
    21092112
    2110         if self.parameters.dry_run:
     2113        if self.parameters.always_notify_reporter:
     2114            global sender_email
     2115            sender_email = self.email_addr
     2116 
     2117            self.logger.debug('\t Using Email2TracNotification function AlwaysNotifyReporter')
     2118            import trac.notification as Email2TracNotification
     2119            Email2TracNotification.Notify.notify = AlwaysNotifyReporter
     2120
     2121        if self.parameters.dry_run  :
    21112122                print 'DRY_RUN: self.notify(tkt, True) reporter = %s' %tkt['reporter']
    21122123                return
     
    21292140                self.env.href = Href(self.get_config('project', 'url'))
    21302141
    2131 
    21322142            tn = TicketNotifyEmail(self.env)
    21332143
     
    21542164            self.logger.error('Failure sending notification on creation of ticket #%s: %s' %(self.id, e))
    21552165
    2156 
     2166########## END Class Definition  ########################################################
     2167
     2168########## Global Notificaition Function ################################################
     2169def AlwaysNotifyReporter(self, resid):
     2170    """
     2171    Copy of def notify() to manipulate recipents to always include reporter for the
     2172    notification.
     2173    """
     2174    (torcpts, ccrcpts) = self.get_recipients(resid)
     2175
     2176    if not tktparser.email_header_acl('notify_reporter_black_list', sender_email, False):
     2177        ## additionally append sender (regardeless of settings in trac.ini)
     2178        #
     2179        if not sender_email in torcpts:
     2180            torcpts.append(sender_email)
     2181
     2182    self.begin_send()
     2183    self.send(torcpts, ccrcpts)
     2184    self.finish_send()
    21572185
    21582186########## Parse Config File  ###########################################################
Note: See TracChangeset for help on using the changeset viewer.