Changeset 73 for emailtotracscript/trunk


Ignore:
Timestamp:
05/22/06 12:46:09 (18 years ago)
Author:
bas
Message:

EmailtoTracScript?:

email2trac.py.in:

  • Fixed an error with duplicate attachments Thanks Walter
File:
1 edited

Legend:

Unmodified
Added
Removed
  • emailtotracscript/trunk/email2trac.py.in

    r72 r73  
    563563
    564564                        # Insert the attachment it differs for the different TRAC versions
    565                         #
     565                        # 
    566566                        if self.VERSION == 0.8:
    567567                                cursor = self.db.cursor()
    568                                 cursor.execute('INSERT INTO attachment VALUES("%s","%s","%s",%d,%d,"%s","%s","%s")'
    569                                         %('ticket', urllib.quote(str(ticket['id'])), filename + '?format=raw', filesize,
    570                                           int(time.time()),'', self.author, 'e-mail') )
     568                                try:
     569                                        cursor.execute('INSERT INTO attachment VALUES("%s","%s","%s",%d,%d,"%s","%s","%s")'
     570                                                %('ticket', urllib.quote(str(ticket['id'])), filename + '?format=raw', filesize,
     571                                                int(time.time()),'', self.author, 'e-mail') )
     572
     573                                # Attachment is already known
     574                                #
     575                                except sqlite.IntegrityError:   
     576                                        self.db.close()
     577                                        return
     578
    571579                                self.db.commit()
     580
    572581                        else:
    573582                                fd = open(path)
     
    673682                from trac.Href import Href
    674683                from trac import util
     684                import sqlite
    675685        elif version == 0.9:
    676686                from trac import attachment
Note: See TracChangeset for help on using the changeset viewer.