python-redmine
python-redmine copied to clipboard
Retrieving all (closed and open) issues from a specific version
Hello,
I recently discovered your library which seems the perfect tool to automate some regular actions on Redmine. I read the documentation and tried several things but I still can't find how to do some specific things which are possible in the web UI.
First, Redmine is version 4.0.5.stable and I initialize the library use with
from redminelib import Redmine
TOKEN = 'XXX'
URL = "https://redmine.example.com"
PROJECT = 'project'
VERSION = 'version'
redmine = Redmine(URL, version='4.0.5.stable', key=TOKEN)
I try to retrieve all (open and closed) issues from a specific version (which is from a specific project)
# OK: filter issues by project_id
redmine.issue.filter(project_id=PROJECT)
# OK: filter issues by project_id and status_id
redmine.issue.filter(project_id=PROJECT,status_id='*')
# KO: filter issues by project_id, status_id and **fixed_version__name**
redmine.issue.filter(project_id=PROJECT,status_id='*',fixed_version__name=VERSION)
# OK: filter issues by project_id, status_id and **fixed_version_id**
redmine.issue.filter(project_id=PROJECT,status_id='*',fixed_version_id=<id>)
Using fixed_version__name
does not work but using fixed_version_id
does. But I can't find the correct way to retrieve this ID from the VERSION name: there is no option in redmine.version.filter()
.
Also in other requests I can successfully use the fixed_version__name
keyword
project = redmine.project.get(PROJECT)
project.issues.filter(fixed_version__name=VERSION)
So I wonder how I can make this specific request using the library: do I need to loop over each issue to verify its fixed_version
?
I have difficulties to understand what is and what is not possible to do with the ORM (I know a little the Django ORM but can't find my way in this one).
For example with the status_id
parameter which works in some queries but not others.
# OK
redmine.issue.filter(project_id=PROJECT)
# OK with '*' or 'open' or 'closed'
redmine.issue.filter(project_id=PROJECT,status_id='*')
# KO -> returns nothing
project.issues.filter(status='*')
project.issues.filter(status='closed')
I thought that the Issue RessourceSet was been used for both redmine.issue
and project.issues
so I can use the same filter()
method. I may misunderstand how it should be used.
Any help would be appreciated.