File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -564,7 +564,24 @@ def __getattr__(self, name):
564564 return self .__dict__ ['_updated_attrs' ][name ]
565565 except KeyError :
566566 try :
567- return self .__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+ if isinstance (value , list ):
580+ self .__dict__ ['_updated_attrs' ][name ] = value [:]
581+ return self .__dict__ ['_updated_attrs' ][name ]
582+
583+ return value
584+
568585 except KeyError :
569586 try :
570587 return self .__dict__ ['_parent_attrs' ][name ]
Original file line number Diff line number Diff 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' in data :
966+ new_data ['labels' ] = ',' .join (data ['labels' ])
967+ return new_data
968+
963969
964970class ProjectMember (SaveMixin , ObjectDeleteMixin , RESTObject ):
965971 _short_print_attr = 'username'
You can’t perform that action at this time.
0 commit comments