Changeset 533


Ignore:
Timestamp:
07/28/11 14:24:30 (13 years ago)
Author:
bas
Message:

ticket_update_by_subject enhancement, closes #253

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r532 r533  
    2929  * Fixed an error in the logging environment for Windows oses, closes #251
    3030    Reported by:  kofal002 add umn dot edu
     31    Fixed by: Bas van der Vlies
     32
     33  * Ticket_update_by_subject enhancement. If multiple tickets are found
     34    with the same subject then we try a author/reporter match. If fails
     35    use most recent ticket entry, closes #253
     36    Reported by: kofal002 att umn dot edu
    3137    Fixed by: Bas van der Vlies
    3238
  • trunk/debian/changelog

    r529 r533  
     1email2trac (2.1.4-1) stable; urgency=low
     2
     3  *  see Changelog
     4
     5 -- Bas van der Vlies <bas@sara.nl>  Thu, 28 Jul 2011 14:22:45 +0200
     6
    17email2trac (2.1.3-1) stable; urgency=low
    28
  • trunk/email2trac.py.in

    r532 r533  
    10241024        self.logger.debug('function ticket_update_by_subject')
    10251025
    1026         matched_id = None
     1026        found_id = None
    10271027        if self.parameters.ticket_update and self.parameters.ticket_update_by_subject:
    10281028               
     
    10521052                    self.logger.debug('Looking for summary matching: "%s"' % summary)
    10531053
    1054                     sql = """SELECT id FROM ticket
     1054                    sql = """SELECT id, reporter FROM ticket
    10551055                            WHERE changetime >= %s AND summary LIKE %s
    10561056                            ORDER BY changetime DESC"""
     1057
    10571058                    cursor.execute(sql, [lookback, summary.strip()])
    10581059
    10591060                    for row in cursor:
    1060                         (matched_id,) = row
    1061 
    1062                         self.logger.debug('Found matching ticket id: %d' % matched_id)
    1063 
    1064                         break
    1065 
    1066                     if matched_id:
    1067                         matched_id = '#%d' % matched_id
    1068                         return (matched_id, orig_subject)
    1069                    
    1070                     subject = orig_subject
    1071 
    1072         return (matched_id, subject)
     1061
     1062                        (matched_id, sql_reporter) = row
     1063
     1064                        ## Save first entry.
     1065                        #
     1066                        if not found_id:
     1067                            found_id = matched_id
     1068                           
     1069                        ## If subject and reporter are the same. The we certainly have found the right ticket
     1070                        #
     1071                        if sql_reporter == self.author:
     1072                            self.logger.debug('Found matching reporter: %s with ticket id: %d' %(sql_reporter, matched_id))
     1073                            found_id = matched_id
     1074                            break
     1075
     1076                    if found_id:
     1077                        self.logger.debug('Found matching ticket id: %d' % found_id)
     1078                        found_id = '#%d' % found_id
     1079                        return (found_id, orig_subject)
     1080                   
     1081                    # obesolete !??
     1082                    #subject = orig_subject
     1083
     1084        return (found_id, subject)
    10731085
    10741086
Note: See TracChangeset for help on using the changeset viewer.