Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Problem with assigning issues to users#2021

Discussion options

Description of the problem, including code/CLI snippet

Under the Gitlab API, in order to assign an issue to users, you must specify their user ID to the listassignee_ids. In the documentation and API reference, I don't seeassignee_ids, I seeassignees. If I manually set the attribute on the object, it works.

Expected Behavior

forindex,assigneesinenumerate(issue_assignees):assignees.assignee_ids.append(user_id)issue_assignees[index].save()

The ticket is assigned to a provideduser_id.

Actual Behavior

issues=project.issues.list(state='opened')forindex,issueinenumerate(issues):ifnotissue.assignees:issue_assignees=get_group_members(stuff)//thisisacustomfunctionthatIgiveitagroupname,anditreturnstheIDsoftheusersinthatgroupinaliste.g., [20,40,50,21,25]t= []forassigneesinissue_assignees:t.append(assignees.id)issue.assignee_ids=tissues[index].save()//onthislinetheissueatpositionindexrefresheswithnoassignees

And the ticket is not updated, nor is there a return code of an issue.

Specifications

  • python-gitlab version: 3.4.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 14.9.3-ee
You must be logged in to vote

Maybe try something like this?

issues=project.issues.list(state='opened')forindex,issueinenumerate(issues):issue=project.issues.get(issue.id)# This may not be necessary but usually a good idea.ifnotissue.assignees:issue_assignees=get_group_members(stuff)//thisisacustomfunctionthatIgiveitagroupname,anditreturnstheIDsoftheusersinthatgroupinaliste.g., [20,40,50,21,25]else:continuet= []forassigneesinissue_assignees:t.append(assignees.id)issue.assignee_ids=tissue.save()issue=project.issues.get(issue.id)issue.pprint()

Replies: 4 comments 6 replies

Comment options

Can you provide more context please? How wasissue_assignees created?

You must be logged in to vote
0 replies
Comment options

Sorry, I'll add/update a more complete version to the report.

You must be logged in to vote
0 replies
Comment options

Maybe try something like this?

issues=project.issues.list(state='opened')forindex,issueinenumerate(issues):issue=project.issues.get(issue.id)# This may not be necessary but usually a good idea.ifnotissue.assignees:issue_assignees=get_group_members(stuff)//thisisacustomfunctionthatIgiveitagroupname,anditreturnstheIDsoftheusersinthatgroupinaliste.g., [20,40,50,21,25]else:continuet= []forassigneesinissue_assignees:t.append(assignees.id)issue.assignee_ids=tissue.save()issue=project.issues.get(issue.id)issue.pprint()
You must be logged in to vote
6 replies
@JohnVillalovos
Comment options

Great to hear you got it working!

So it is documented here:https://docs.gitlab.com/ee/api/issues.html#edit-issue

If you would like to do a PR to help improve thepython-gitlab documentation it would be appreciated. This area could use some help:https://python-gitlab.readthedocs.io/en/stable/gl_objects/issues.html

As a note it appears thatassignee_ids is not returned in theget() but is used when creating or editing an issue.

@MichaelSweikata
Comment options

Okay, so that actually helps me understand the docsa little better. Because essentially what you've got is any time Gitlab makes a change to that api, you're automatically adjusting for it by letting the user add new parameters on the fly.

But yes, I'm happy to contribute to the project in that way. I'll get a branch together for review.

@MichaelSweikata
Comment options

So I have some documentation written out following the contributors guide, but I don't have permission to push a branch up.

@nejch
Comment options

@MichaelSweikata
Comment options

Ah ha! Thank you. Haven't contributed this way before, so, thanks for pointing that out. I'll have to read up on Forking Workflows.

Answer selected byJohnVillalovos
Comment options

Okay, apologies, I couldn't figure out the commit squashing, and rather than spin in circles for a few days while a simple doc update just needs to go in, I made a new branch with a single commit containing the changes:

#2025

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
3 participants
@MichaelSweikata@JohnVillalovos@nejch
Converted from issue

This discussion was converted from issue #2020 on May 16, 2022 16:48.


[8]ページ先頭

©2009-2025 Movatter.jp