Changeset 533 for trunk/email2trac.py.in


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

ticket_update_by_subject enhancement, closes #253

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.