Programmatically getting issues
06 Apr 2005
Or, how to not use objectValues(), objectIds() or objectItems()
If you're writing a Zope script that does some listing of your issues in an IssueTrackerProduct instance then you should use getIssueObjects() instead. Then you don't even need to know the meta_type of an issue. Here's an example:
issuetracker = context.MyIssueTracker issues = issuetracker.getIssueObjects() print "No of issues: %s"%len(issues) return printed
The advantage with this approach is related to the new feature that lets you store your issues in a BTreeFolder2
Using getIssueObjects() makes sure it works independent of what storage you use.
There's also:
getIssueItems(), equivalent ofobjectItems("Issue Tracker Issue")getIssueIds(), equivalent ofobjectIds("Issue Tracker Issue")
Advanced note
If you need to get all the follow ups inside an issue you can use the rather arcane:ListThreads() method. Here's an example:
issuetracker = context.MyIssueTracker
issues = issuetracker.getIssueObjects()
for issue in issues:
threads = issue.ListThreads()
print issue.getTitle() + " has %s followups\n"%len(threads)
return printed