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

Commite09581f

Browse files
author
Gauvain Pocentek
committed
Fix the labels attrs on MR and issues
Fixes#306
1 parent89bf53f commite09581f

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

‎gitlab/base.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,24 @@ def __getattr__(self, name):
564564
returnself.__dict__['_updated_attrs'][name]
565565
exceptKeyError:
566566
try:
567-
returnself.__dict__['_attrs'][name]
567+
value=self.__dict__['_attrs'][name]
568+
569+
# If the value is a list, we copy it in the _updated_attrs dict
570+
# because we are not able to detect changes made on the object
571+
# (append, insert, pop, ...). Without forcing the attr
572+
# creation __setattr__ is never called, the list never ends up
573+
# in the _updated_attrs dict, and the update() and save()
574+
# method never push the new data to the server.
575+
# See https://github.com/python-gitlab/python-gitlab/issues/306
576+
#
577+
# note: _parent_attrs will only store simple values (int) so we
578+
# don't make this check in the next except block.
579+
ifisinstance(value,list):
580+
self.__dict__['_updated_attrs'][name]=value[:]
581+
returnself.__dict__['_updated_attrs'][name]
582+
583+
returnvalue
584+
568585
exceptKeyError:
569586
try:
570587
returnself.__dict__['_parent_attrs'][name]

‎gitlab/v4/objects.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,12 @@ class ProjectIssueManager(CRUDMixin, RESTManager):
960960
'milestone_id','labels','created_at',
961961
'updated_at','state_event','due_date'))
962962

963+
def_sanitize_data(self,data,action):
964+
new_data=data.copy()
965+
if'labels'indata:
966+
new_data['labels']=','.join(data['labels'])
967+
returnnew_data
968+
963969

964970
classProjectMember(SaveMixin,ObjectDeleteMixin,RESTObject):
965971
_short_print_attr='username'

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp