Roundup Tracker

Attachment 'make_issue_example.py'

Download

   1 #!/usr/bin/env python
   2 #
   3 # Example Script to generate a test issue, minimal stuff done
   4 # Author: Ludwig Reiter
   5 # Requires python 2.7
   6 #
   7 # Copyright (C) 2019 by Intevation GmbH
   8 # This file is Free Software under the GNU GPL (v>=2)
   9 # and comes with ABSOLUTELY NO WARRANTY!
  10 
  11 import roundup.instance
  12 import sys
  13 
  14 subject = "testtesttest"
  15 text_msg = """Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
  16  incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nost
  17 rud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis a
  18 ute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
  19  nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."""
  20 
  21 # Needs to be path to tracker
  22 TRACKERHOME = ""  # Add path to tracker here
  23 USERID = "3"  # Add userid for the item here
  24 USER = "ludwig1"  # Add user for the item
  25 
  26 try:
  27     tracker = roundup.instance.open(TRACKERHOME)
  28 except:
  29     sys.stderr.write('Unable to open tracker in %s\n' % TRACKERHOME)
  30     sys.exit(2)
  31 
  32 db = tracker.open()
  33 
  34 try:
  35     db.journaltag = USER
  36     message_list =[]
  37     for msg_count in range(30):
  38         this_message = db.msg.create(author=USERID, content=text_msg,
  39                                      date=roundup.date.Date())
  40         message_list.append(this_message)
  41     this_issue = db.issue.create(title=subject, nosy=[USERID], priority="1",
  42                                  messages=message_list, status="1",
  43                                  assignedto=USERID)
  44     db.commit()
  45     print("OK", this_issue)
  46 except Exception as error:
  47     print("Error", error)

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] (2019-09-18 10:17:06, 1.6 KB) [[attachment:make_issue_example.py]]
 All files | Selected Files: delete move to page copy to page

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