Comments (4)
Hello, Han!
If you need to access the parent issue of the issue you have to use the parent
attribute of the issue resource, BUT it's only available ONLY if the issue has a parent issue, e.g.:
>>> from redmine import Redmine
>>> redmine = Redmine('http://your-redmine.url', username='jsmith', password='foobar')
>>> issue = redmine.issue.get(12345)
>>> dir(issue)
['attachments',
'author',
'changesets',
'children',
'created_on',
'custom_fields',
'description',
'done_ratio',
'id',
'journals',
'parent', <---------- here it is
'priority',
'project',
'relations',
'spent_hours',
'start_date',
'status',
'subject',
'time_entries',
'tracker',
'updated_on',
'watchers']
>>> issue.parent
{'id': 54321}
But if an issue doesn't have a parent issue, then the parent
attribute won't be available. Also at the moment if you call
issue.parent
project.parent
etc., it returns a dict, and not a resource object as it should, this is a bug in the python-redmine and will be fixed in the version. That means that you have to manually fetch the parent issue like that
parent_issue = redmine.issue.get(issue.parent['id'])
If you need to access the children issues from a parent issue you can call
issue.children
which return a ResourceSet object of children issue resources if any
from python-redmine.
The bug with parent
resource attribute not being converted to Resource object is fixed in 4d95d93 and will be released to PyPI later today.
from python-redmine.
v0.8.1 with a fix released to PyPI.
from python-redmine.
Thank you for your explanation.
I selected the wrong Issue which didn't have Parent. After switching to the right one, I could see Parent. And I am happy that my question - accidentally - could contribute to python-redmine :)
from python-redmine.
Related Issues (20)
- tags from task HOT 2
- check the existence of a task HOT 1
- Copy project HOT 2
- Is it possible to integrate a "geojson" parameter in issue creation? HOT 2
- KeyError: 'time_entry' HOT 3
- Cant Set priority_id HOT 5
- When adding a user to a group that they are already a member of get "User is invalid" HOT 2
- How to: Create Issue onbehalf of another user HOT 4
- Bug: User does not return status HOT 3
- Bug: Users.all() does not return all users HOT 4
- When querying resources, why is there a default_includes HOT 2
- Leaks API key on exception HOT 2
- Filter by application subject HOT 2
- BytesIO is not JSON serializable HOT 4
- ResourceNotFoundError: Requested resource doesn't exist HOT 2
- Get Request - ResourceNotFoundError: Requested resource doesn't exist HOT 2
- filter error HOT 2
- ???????? for Russian text HOT 6
- adding custom fields to project HOT 2
- Get member users from project_membership HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-redmine.