diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 67cbf24..38962c5 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -3473,6 +3473,8 @@ def set_custom_key_fields(session, project, fields, types, data): if types[idx] != "list": # Only Lists use data, strip it otherwise data[idx] = None + else: + data[idx] = [item.strip() for item in data[idx].split(',')] if key in current_keys: issuekey = current_keys[key] diff --git a/pagure/lib/model.py b/pagure/lib/model.py index d3dde2d..19707a4 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -1002,44 +1002,18 @@ class IssueKeys(BASE): @property def data(self): ''' Return the list of items ''' - items = {} if self.key_data: - items = json.loads(self.key_data) + return json.loads(self.key_data) else: return None - return items['list'] - - @property - def data_string(self): - ''' Take the list from key_data and convert it to a string. - This is used by the project settings custom field section. ''' - - if self.key_data: - mylist = json.loads(self.key_data) - else: - return "" - - return_str = "" - first_item = True - if mylist: - for item in mylist['list']: - if first_item: - return_str = item - first_item = False - else: - return_str = return_str + ", " + item - return return_str @data.setter def data(self, list_str): - ''' Ensures the list items are properly saved. ''' + ''' Store the list in JSON. ''' if list_str is None: self.key_data = None else: - list_list = [item.strip() for item in list_str.split(',')] - list_data = {} - list_data['list'] = list_list - self.key_data = json.dumps(list_data) + self.key_data = json.dumps(list_str) class IssueValues(BASE): diff --git a/pagure/templates/settings.html b/pagure/templates/settings.html index 740c21c..a0a90c3 100644 --- a/pagure/templates/settings.html +++ b/pagure/templates/settings.html @@ -733,7 +733,7 @@