Changeset 672


Ignore:
Timestamp:
10/19/15 12:42:25 (7 years ago)
Author:
bas
Message:

made email2trac compatible with trac version 1.1 and adjusted msg.txt to new surfsara.nl address

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/email2trac.py.in

    r671 r672  
    374374        #   e : email address that the user has set in the settings tab
    375375        #
    376         users = [ (u,n,e) for (u, n, e) in self.env.get_known_users(self.db)
     376        #users = [ (u,n,e) for (u, n, e) in self.env.get_known_users(self.db)
     377        users = [ (u,n,e) for (u, n, e) in self.env.get_known_users()
    377378            if (
    378379                (e and (e.lower() == self.email_addr.lower())) or
     
    10051006        ## When is the change committed
    10061007        #
    1007         if self.VERSION < 0.11:
    1008             when = int(time.time())
    1009         else:
    1010             when = datetime.now(util.datefmt.utc)
     1008        when = datetime.now(util.datefmt.utc)
    10111009
    10121010        try:
     
    10301028        ## How many changes has this ticket
    10311029        #
    1032         grouped = TicketModule(self.env).grouped_changelog_entries(tkt, self.db)
     1030        #grouped = TicketModule(self.env).grouped_changelog_entries(tkt, self.db)
     1031        grouped = TicketModule(self.env).grouped_changelog_entries(tkt)
    10331032        cnum = sum(1 for e in grouped) + 1
    10341033
     
    10371036        #  We must use the ticket workflow framework
    10381037        #
    1039         if self.parameters.email_triggers_workflow and (self.VERSION >= 0.11):
    1040 
     1038        if self.parameters.email_triggers_workflow:
    10411039            if not self.mail_workflow(tkt):
    1042 
    10431040                if tkt['status'] in ['closed']:
    10441041                    tkt['status'] = 'reopened'
    10451042                    tkt['resolution'] = ''
    1046 
    1047         ## Old pre 0.11 situation
    1048         #
    1049         elif self.parameters.email_triggers_workflow:
    1050 
    1051             self.logger.debug('\temail triggers workflow pre trac 0.11')
    1052 
    1053             if tkt['status'] in ['closed']:
    1054                 tkt['status'] = 'reopened'
    1055                 tkt['resolution'] = ''
    1056 
    10571043        else:
    10581044            self.logger.debug('\temail triggers workflow disabled')
     
    13051291        ## When is the change committed
    13061292        #
    1307         if self.VERSION < 0.11:
    1308             when = int(time.time())
    1309         else:
    1310             when = datetime.now(util.datefmt.utc)
     1293        when = datetime.now(util.datefmt.utc)
    13111294
    13121295        if self.parameters.dry_run:
     
    13451328            comment = '%s\n%s\n' %(comment, error_with_attachments)
    13461329
    1347         if self.parameters.email_triggers_workflow and (self.VERSION >= 0.11):
     1330        if self.parameters.email_triggers_workflow:
    13481331            if self.mail_workflow(tkt):
    13491332                changed = True
     
    17781761            self.save_email_for_debug(m, self.parameters.project_name, True)
    17791762
    1780         if self.VERSION <= 0.11:
    1781             self.db = self.env.get_db_cnx()
    1782         else:
    1783             self.db = self.env.get_read_db()
     1763        self.db = self.env.get_read_db()
    17841764
    17851765        self.get_sender_info(m)
     
    24582438               )
    24592439
    2460         if self.VERSION in [ 0.10 ]:
    2461             s = '\r\n{{{\r\n#!html\r\n<a\r\n href="mailto:%s">Reply to: %s\r\n</a>\r\n}}}\r\n' %(s, author)
    2462         else:
    2463             s = '[mailto:"%s" Reply to: %s]' %(s, author)
     2440        s = '[mailto:"%s" Reply to: %s]' %(s, author)
    24642441
    24652442        self.logger.debug("\tmailto link %s" %s)
     
    25132490        try:
    25142491
    2515 
    2516             ## create false {abs_}href properties, to trick Notify()
    2517             #
    2518             if self.VERSION in [0.10]:
    2519                 self.env.abs_href = Href(self.get_config('project', 'url'))
    2520                 self.env.href = Href(self.get_config('project', 'url'))
    2521 
    25222492            tn = Email2TracNotifyEmail(self.env)
    25232493
     
    25522522            if self.parameters.alternate_notify_template:
    25532523
    2554                 if self.VERSION >= 0.11:
     2524                if self.VERSION >= 0.12:
    25552525
    25562526                    from trac.web.chrome import Chrome
     
    28142784   
    28152785    try:
    2816         if version == '0.10':
    2817             from trac import attachment
    2818             from trac.env import Environment
    2819             from trac.ticket import Ticket
    2820             from trac.web.href import Href
    2821             from trac import util
    2822             from trac.ticket.web_ui import TicketModule
    2823 
    2824             #
    2825             # return  util.text.to_unicode(str)
    2826             #
    2827             # see http://projects.edgewall.com/trac/changeset/2799
    2828             from trac.ticket.notification import TicketNotifyEmail
    2829             from trac import config as trac_config
    2830             from trac.core import TracError
    2831 
    2832         elif version in ['0.11', '0.12', '0.13', '1.0', '1.1']:
     2786
     2787        if version in ['0.12', '0.13', '1.0', '1.1']:
    28332788            from trac import attachment
    28342789            from trac import config as trac_config
  • trunk/msg.txt

    r631 r672  
    11From bas.vandervlies@surfsara.nl  Wed Mar  8 15:29:17 2006
    2 Return-Path: <basv@sara.nl>
     2Return-Path: <bas.vandervlies@surfsara.nl>
    33X-Original-To: test@subtrac.sara.nl
    44Delivered-To: test@subtrac.sara.nl
     
    1111Message-ID: <440EEA39.6070200@sara.nl>
    1212Date: Wed, 08 Mar 2006 15:29:13 +0100
    13 From: Bas van der Vlies <basv@sara.nl>
     13From: Bas van der Vlies <bas.vandervlies@surfsara.nl>
    1414User-Agent: Thunderbird 1.5 (Windows/20051201)
    1515MIME-Version: 1.0
Note: See TracChangeset for help on using the changeset viewer.