Roundup Tracker

Attachment 'check-tracker.py'

Download

   1 #! /usr/bin/env python
   2 #
   3 # Daily issue maintenance
   4 #
   5 
   6 # Roundup boto uses several deprecated modules
   7 import warnings
   8 warnings.filterwarnings("ignore", "", DeprecationWarning, "roundup")
   9 
  10 import sys
  11 from roundup import instance
  12 from roundup.date import Date
  13 from roundup.date import Interval
  14 
  15 # Change the following line to true to physically
  16 # delete issues which are done and have had no activity
  17 # in the last 3 months
  18 expireOld = false
  19 
  20 # open the instance
  21 if len(sys.argv) != 2:
  22     print 'You need to specify an instance home dir'
  23 instance_home = sys.argv[1]
  24 inst = instance.open(instance_home)
  25 db = inst.open('admin')
  26 
  27 # Store commonly used id's
  28 waiting_id = db.status.lookup('waiting')
  29 done_id = db.status.lookup('done')
  30 att_id = db.status.lookup('needs attention')
  31 
  32 # Revive messages whose time has come
  33 for id in db.issue.filter(None, { "revives": "-6m;.",
  34                                   "status": waiting_id }):
  35     db.issue.set(id, revives=None)
  36     db.issue.set(id, status=att_id)
  37 
  38 
  39 
  40 # Expiry
  41 if expireOld:
  42     for id in db.issue.filter(None, { "activity": "-99y;-3m",
  43                                       "status": done_id }):
  44         for id2 in db.issue.find(superseder=id):
  45             superseder = [ x for x in db.issue.get(id2, "superseder") \
  46                                if x != id ]
  47             # Setting this to None instead of [] produces an error in an auditor
  48             #if superseder == []:
  49             #    superseder = None
  50             #print "Setting superseder of issue ", id2, " to ", superseder
  51             db.issue.set(id2, superseder=superseder)
  52         #print "Destroying issue ", id
  53         for msg_id in db.issue.get(id, "messages"):
  54             if len(db.issue.find(messages=msg_id)) == 1:
  55                 for file_id in db.msg.get(msg_id, "files"):
  56                     if len(db.msg.find(files=file_id)) == 1:
  57                         db.file.destroy(file_id)
  58                 db.msg.destroy(msg_id)
  59             db.issue.destroy(id)
  60 
  61 db.commit()
  62 db.close()

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2010-04-24 15:49:27, 5.8 KB) [[attachment:add-issues.py]]
  • [get | view] (2010-04-24 15:49:36, 2.0 KB) [[attachment:check-tracker.py]]
  • [get | view] (2010-04-24 15:49:32, 3.6 KB) [[attachment:deprevive.py]]
  • [get | view] (2010-04-24 16:01:17, 7.8 KB) [[attachment:html.diff]]
  • [get | view] (2010-04-24 15:49:51, 2.4 KB) [[attachment:remind-tracker.py]]
  • [get | view] (2010-04-24 15:49:22, 130.3 KB) [[attachment:todo.png]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.