Changeset 99


Ignore:
Timestamp:
07/13/06 14:39:25 (18 years ago)
Author:
bas
Message:

EmailtoTracScript?:

delete_spam.py.in:

  • Fixed several erros
Location:
emailtotracscript/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • emailtotracscript/trunk/ChangeLog

    r98 r99  
    1212          Fixed by: Bas van der Vlies
    1313
     14        * delete_spam.py
     15           - did not clean up the attachment table. So we got nasty new
     16             mails with fake attachments.
     17           - It works now for versions higher then 0.8
     18       
    14192006-07-06
    1520        * Fixed an error in already added attachments. Do not close
  • emailtotracscript/trunk/debian/changelog

    r98 r99  
     1email2trac (0.7.6-2) stable; urgency=low
     2
     3  * Fixed delete_spam.py for versions higher then 0.8
     4
     5 -- Bas van der Vlies <basv@sara.nl>  Thu, 13 Jul 2006 14:28:55 +0200
     6
     7email2trac (0.7.6-1) stable; urgency=low
     8
     9  * Fixes delete_spam.py also delete from attachment table
     10    Fixes: Jaap Dijkshoorn
     11
     12 -- root <root@rc.sara.nl>  Thu, 13 Jul 2006 12:33:41 +0200
     13
    114email2trac (0.7.5-1) stable; urgency=low
    215
  • emailtotracscript/trunk/delete_spam.py.in

    r69 r99  
    7979                        env = Environment(project, create=0)
    8080                        db = env.get_db_cnx()
    81                        
     81
     82                        attachment_dir = os.path.join(env.path, 'attachments', 'ticket')
     83
    8284                        cursor = db.cursor()
    8385
     
    9092                                        break
    9193                                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):
    94100                                        if debug:
    95                                                 print 'delete %s : %s' %(spam_id, attachment_dir)
     101                                                print 'delete %s : %s' %(spam_id, dir)
    96102                                        try:
    97                                                 shutil.rmtree(attachment_dir)
     103                                                shutil.rmtree(dir)
    98104                                        except OSError, detail:
    99105                                                print 'Contact system-administrator: %s' %detail
Note: See TracChangeset for help on using the changeset viewer.