comparison sat/plugins/plugin_exp_list_of_interest.py @ 3304:9a174abafdee

plugin list of interests: added `id` to data + fixed key conflict: fixed conflict between interest namespace and files namespace.
author Goffi <goffi@goffi.org>
date Fri, 19 Jun 2020 15:38:17 +0200
parents f17379123571
children 56ee491c0df6
comparison
equal deleted inserted replaced
3303:f17379123571 3304:9a174abafdee
188 ) 188 )
189 189
190 def _listInterestsSerialise(self, interests_data): 190 def _listInterestsSerialise(self, interests_data):
191 interests = [] 191 interests = []
192 for item_elt in interests_data[0]: 192 for item_elt in interests_data[0]:
193 interest_data = {} 193 interest_data = {"id": item_elt['id']}
194 interest_elt = item_elt.interest 194 interest_elt = item_elt.interest
195 if interest_elt.hasAttribute('namespace'): 195 if interest_elt.hasAttribute('namespace'):
196 interest_data['namespace'] = interest_elt.getAttribute('namespace') 196 interest_data['namespace'] = interest_elt.getAttribute('namespace')
197 if interest_elt.hasAttribute('name'): 197 if interest_elt.hasAttribute('name'):
198 interest_data['name'] = interest_elt.getAttribute('name') 198 interest_data['name'] = interest_elt.getAttribute('name')
217 "type": "file_sharing", 217 "type": "file_sharing",
218 "service": elt['service'], 218 "service": elt['service'],
219 }) 219 })
220 if elt.hasAttribute('type'): 220 if elt.hasAttribute('type'):
221 interest_data['subtype'] = elt['type'] 221 interest_data['subtype'] = elt['type']
222 for attr in ('namespace', 'path'): 222 for attr in ('files_namespace', 'path'):
223 if elt.hasAttribute(attr): 223 if elt.hasAttribute(attr):
224 interest_data[attr] = elt[attr] 224 interest_data[attr] = elt[attr]
225 else: 225 else:
226 log.warning("unknown element, ignoring: {xml}".format(xml=elt.toXml())) 226 log.warning("unknown element, ignoring: {xml}".format(xml=elt.toXml()))
227 continue 227 continue