Changeset 99 for emailtotracscript/trunk/delete_spam.py.in
- Timestamp:
- 07/13/06 14:39:25 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
emailtotracscript/trunk/delete_spam.py.in
r69 r99 79 79 env = Environment(project, create=0) 80 80 db = env.get_db_cnx() 81 81 82 attachment_dir = os.path.join(env.path, 'attachments', 'ticket') 83 82 84 cursor = db.cursor() 83 85 … … 90 92 break 91 93 spam_id = row[0] 92 attachment_dir = os.path.join(env.get_attachments_dir(), 'ticket', str(spam_id)) 93 if os.path.exists(attachment_dir): 94 95 sql_cmd = "DELETE FROM attachment WHERE type='ticket' and id='%s';" %spam_id 96 cursor.execute(sql_cmd) 97 98 dir = os.path.join(attachment_dir, str(spam_id)) 99 if os.path.exists(dir): 94 100 if debug: 95 print 'delete %s : %s' %(spam_id, attachment_dir)101 print 'delete %s : %s' %(spam_id, dir) 96 102 try: 97 shutil.rmtree( attachment_dir)103 shutil.rmtree(dir) 98 104 except OSError, detail: 99 105 print 'Contact system-administrator: %s' %detail
Note: See TracChangeset
for help on using the changeset viewer.