Changeset 116


Ignore:
Timestamp:
10/05/06 14:10:20 (18 years ago)
Author:
bas
Message:

EmailtoTracScript?:

delete_spam.py.in:

  • Now do db.commit after one ticket is deleted
  • Use a db connection for other tables
  • Added debug statements
File:
1 edited

Legend:

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

    r111 r116  
    8383
    8484                        cursor = db.cursor()
     85                        tkt_cursor = db.cursor()
    8586
    8687                        # Delete the attachments associated with Spam tickets
     
    9394                                spam_id =  row[0]
    9495
     96                                if debug:
     97                                        sql_cmd = "SELECT *  FROM attachment WHERE type='ticket' and id='%s';" %spam_id
     98                                        tkt_cursor.execute(sql_cmd)
     99                                        row = tkt_cursor.fetchone()
     100                                        print row
     101
     102                                        sql_cmd = "SELECT * FROM ticket_change WHERE ticket='%s';" %spam_id
     103                                        tkt_cursor.execute(sql_cmd)
     104                                        row = tkt_cursor.fetchone()
     105                                        print row
     106                                       
     107                                        sql_cmd = "SELECT * FROM ticket_custom WHERE ticket='%s';" %spam_id
     108                                        tkt_cursor.execute(sql_cmd)
     109                                        row = tkt_cursor.fetchone()
     110                                        print row
     111
    95112                                sql_cmd = "DELETE FROM attachment WHERE type='ticket' and id='%s';" %spam_id
    96                                 cursor.execute(sql_cmd)
     113                                tkt_cursor.execute(sql_cmd)
    97114
    98115                                sql_cmd = "DELETE FROM ticket_change WHERE ticket='%s';" %spam_id
    99                                 cursor.execute(sql_cmd)
     116                                tkt_cursor.execute(sql_cmd)
    100117
    101118                                sql_cmd = "DELETE FROM ticket_custom WHERE ticket='%s';" %spam_id
    102                                 cursor.execute(sql_cmd)
     119                                tkt_cursor.execute(sql_cmd)
     120
     121                                # Ticket commit
     122                                #
     123                                db.commit()
    103124
    104125                                dir = os.path.join(attachment_dir, str(spam_id))
Note: See TracChangeset for help on using the changeset viewer.