On 06/27/2012 09:24 AM, christoph müller wrote:
> this process is not for the usual bugtracking. but...
> 
> I'm testing trac for its ability to help in the process of building a 
> classification system for information management (records
> management).
> 
> trac could be an exciting tool. I like it especially the possibility to 
> create sql queries.
> 
> with the ticketimportplugin I read the structure into tickets.
> 
> users can submit their comments.
> 
> because the import gives not always the desired result, sometimes several 
> attempts are necessary.
> 
> deleting all tickets at once would be a great help instead of set up the trac 
> project new.
> 
This is a code snippet from the email2trac package (delete_spam)
if you replace Spame with '*' vertyhing should work.


def new_delete_spam(parameters):
        """
        This only works for trac versions higher or equal then 0.10
        """

        debug = int(parameters['debug'])
        DRY_RUN = parameters['DRY_RUN']
        VERBOSE = parameters['VERBOSE']

        project = parameters['project']


        env = Environment(project, create=0)
        db = env.get_db_cnx()

        cursor = db.cursor()
        cursor.execute("SELECT id FROM ticket WHERE  component = 'Spam';")
        while 1:
                row = cursor.fetchone()
                if not row:
                        break

                spam_id =  row[0]

                if debug or DRY_RUN or VERBOSE:
                        print "Deleting ticket %s" %spam_id

                try:
                        tkt = Ticket(env, spam_id, db)
                except util.TracError, detail:
                        print detail
                        continue

                if DRY_RUN:
                        print 'DRY_RUN: tkt.delete()'
                else:
                        tkt.delete()

-- 
********************************************************************
*  Bas van der Vlies                    e-mail: [email protected]       *
*  SARA - Academic Computing Services   Amsterdam, The Netherlands *
********************************************************************



Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to