Changeset 137
- Timestamp:
- 12/01/06 12:30:36 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
emailtotracscript/trunk/delete_spam.py.in
r128 r137 87 87 db = env.get_db_cnx() 88 88 89 cursor = db.cursor() 89 90 cursor.execute("SELECT id FROM ticket WHERE component = 'Spam';") 90 91 while 1: … … 95 96 spam_id = row[0] 96 97 98 if debug: 99 print "Deleting ticket %s" %spam_id 100 97 101 try: 98 102 tkt = Ticket(env, spam_id, db) 99 except TracError, detail: 103 except util.TracError, detail: 104 print detail 100 105 continue 101 106 102 if debug:103 print "Deleting ticket %s" %spam_id104 105 107 tkt.delete() 106 108 … … 124 126 break 125 127 spam_id = row[0] 126 128 127 129 if debug: 130 print spam_id 131 128 132 sql_cmd = "SELECT * FROM attachment WHERE type='ticket' and id='%s';" %spam_id 129 133 tkt_cursor.execute(sql_cmd) … … 153 157 # 154 158 db.commit() 159 155 160 dir = os.path.join(attachment_dir, str(spam_id)) 156 161 if os.path.exists(dir): … … 202 207 if version == 0.8: 203 208 from trac.Environment import Environment 209 from trac import util 204 210 else: 205 211 from trac.env import Environment 206 212 from trac.ticket import Ticket 213 from trac import util 207 214 208 215 if version == 0.10: 209 216 new_delete_spam(settings['project'], int(settings['debug'])) 217 #new_delete_spam(settings['project'], 1) 218 #old_delete_spam(settings['project'], 0) 210 219 elif version == 0.9: 211 220 old_delete_spam(settings['project'], int(settings['debug']))
Note: See TracChangeset
for help on using the changeset viewer.