| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -564,7 +564,24 @@ def __getattr__(self, name): | |||
| 564 | 564 | return self.__dict__['_updated_attrs'][name] | |
| 565 | 565 | except KeyError: | |
| 566 | 566 | 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 | + | ||
| 568 | 585 | except KeyError: | |
| 569 | 586 | try: | |
| 570 | 587 | return self.__dict__['_parent_attrs'][name] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -960,6 +960,12 @@ class ProjectIssueManager(CRUDMixin, RESTManager): | |||
| 960 | 960 | 'milestone_id', 'labels', 'created_at', | |
| 961 | 961 | 'updated_at', 'state_event', 'due_date')) | |
| 962 | 962 | ||
| 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 | + | ||
| 963 | 969 | ||
| 964 | 970 | class ProjectMember(SaveMixin, ObjectDeleteMixin, RESTObject): | |
| 965 | 971 | _short_print_attr = 'username' | |
| Back | FazBrowse Home | New Git URL |
0 commit comments