Ignore:
Timestamp:
12/01/06 12:30:36 (17 years ago)
Author:
bas
Message:

EmailtoTracScript?:

delete_spam.py.in:

  • Did not work for version 0.10, fixed it
File:
1 edited

Legend:

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

    r128 r137  
    8787        db = env.get_db_cnx()
    8888
     89        cursor = db.cursor()
    8990        cursor.execute("SELECT id FROM ticket WHERE  component = 'Spam';")
    9091        while 1:
     
    9596                spam_id =  row[0]
    9697
     98                if debug:
     99                        print "Deleting ticket %s" %spam_id
     100
    97101                try:
    98102                        tkt = Ticket(env, spam_id, db)
    99                 except TracError, detail:
     103                except util.TracError, detail:
     104                        print detail
    100105                        continue
    101106
    102                 if debug:
    103                         print "Deleting ticket %s" %spam_id
    104                
    105107                tkt.delete()
    106108
     
    124126                        break
    125127                spam_id =  row[0]
    126                
     128       
    127129                if debug:
     130                        print spam_id
     131
    128132                        sql_cmd = "SELECT *  FROM attachment WHERE type='ticket' and id='%s';" %spam_id
    129133                        tkt_cursor.execute(sql_cmd)
     
    153157                #
    154158                db.commit()
     159
    155160                dir = os.path.join(attachment_dir, str(spam_id))
    156161                if os.path.exists(dir):
     
    202207        if version == 0.8:
    203208                from trac.Environment import Environment
     209                from trac import util
    204210        else:
    205211                from trac.env import Environment
    206212                from trac.ticket import Ticket
     213                from trac import util
    207214
    208215        if version == 0.10:
    209216                new_delete_spam(settings['project'], int(settings['debug']))
     217                #new_delete_spam(settings['project'], 1)
     218                #old_delete_spam(settings['project'], 0)
    210219        elif version == 0.9:
    211220                old_delete_spam(settings['project'], int(settings['debug']))
Note: See TracChangeset for help on using the changeset viewer.