Defect #38814

Updated by Holger Just 8 months ago

 I am writing a python script using python-redmine module to automate notifying team about the list of Redmine issues in Design status but Target Version is not yet set in Redmine.  

 With the help of python-redmine documentation, it was quite easy to read issues and get the issue.status attribute. 
 Now, for a given issue, I would like to get the Target Version. I am able to list out the supported attributes of a Redmine issue and came to know that Target Version is internally referred as "fixed_version" in Redmine as per the output of  

 <pre><code class="python"> 

 I tried to read it via different methods given below. 

 <pre><code class="python"> 

 But all the above options resulted in 

 raise exceptions.ResourceAttrError 
 redminelib.exceptions.ResourceAttrError: Resource doesn't have the requested attribute 

 So tried the below lines, but it is always returning @target_version_set@ target_version_set to true.  
 Can anyone please help me to get the Target Version of a Redmine issue? 

 My Redmine version is 4.1.0.stable.142, python version is 3.9.5 and python-redmine module version is 2.4.0  

 <pre><code class="python"> 
 redmine = Redmine('http://redmine_url', username='uname', password='pwd') 
 issues = redmine.issue.filter(project_id=project_id, status_id='open', include='journals', sort='tracker,priority') 
 for issue in issues: 
	 #target_version = None 
	 #target_version = issue.fixed_version 
	 #target_version = 
	 #target_version = issue.fixed_version_id 
	 issue_details = list(redmine.issue.get(  
	 print (issue_details) 
	 target_version_set = getattr(issue_details,'fixed_version',True) 
	 print (target_version_set) 
	 #if issue.status == "Design" and target_version is None 
	 if issue.status == "Design" and not target_version_set: 
   		 print(f"Target Version is not set for Issue No.", {})