Coder Social home page Coder Social logo

question of Issues about python-redmine HOT 4 CLOSED

jeonghanlee avatar jeonghanlee commented on July 27, 2024
question of Issues

from python-redmine.

Comments (4)

maxtepkeev avatar maxtepkeev commented on July 27, 2024

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.

maxtepkeev avatar maxtepkeev commented on July 27, 2024

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.

maxtepkeev avatar maxtepkeev commented on July 27, 2024

v0.8.1 with a fix released to PyPI.

from python-redmine.

jeonghanlee avatar jeonghanlee commented on July 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.