Edgewall Software

Ticket #1045: 1045.diff

File 1045.diff, 1.2 KB (added by justus@…, 4 years ago)

patch to close ticket

  • trac/Ticket.py

     
    136136               not self._old.has_key('owner'): 
    137137            cursor.execute('SELECT owner FROM component ' 
    138138                           'WHERE name=%s', self._old['component']) 
    139             old_owner = cursor.fetchone()[0] 
    140             if self['owner'] == old_owner: 
    141                 cursor.execute('SELECT owner FROM component ' 
    142                                'WHERE name=%s', self['component']) 
    143                 self['owner'] = cursor.fetchone()[0] 
     139            row = cursor.fetchone() 
     140            # if the old component has been removed from the database 
     141            # then we just leave the owner as is. 
     142            if row: 
     143                old_owner = cursor.fetchone()[0] 
     144                if self['owner'] == old_owner: 
     145                    cursor.execute('SELECT owner FROM component ' 
     146                                   'WHERE name=%s', self['component']) 
     147                    row = cursor.fetchone() 
     148                    self['owner'] = cursor.fetchone()[0] 
    144149            
    145150 
    146151        for name in self._old.keys():