# HG changeset patch # User Goffi # Date 1504850525 -7200 # Node ID 95c83899b5e96a793f142645cfe11ea38102ef7d # Parent c72fcbdcdab7c1af1d1c853b1a4506fd60df9e4f pgsql: fixed bad data filling in getItemsData: item_id was wrongly used to fill ItemData container. Attribute names instead of index are now used to avoid this in the future. diff -r c72fcbdcdab7 -r 95c83899b5e9 sat_pubsub/pgsql_storage.py --- a/sat_pubsub/pgsql_storage.py Fri Sep 08 08:02:05 2017 +0200 +++ b/sat_pubsub/pgsql_storage.py Fri Sep 08 08:02:05 2017 +0200 @@ -964,24 +964,24 @@ if unrestricted and not ids_only: # with unrestricted query, we need to fill the access_list for a roster access items ret = [] - for data in result: - item = generic.stripNamespace(parseXml(data[0])) - access_model = data[1] - item_id = data[2] - date = data[3] + for item_data in result: + item = generic.stripNamespace(parseXml(item_data.data)) + access_model = item_data.access_model + item_id = item_data.item_id + date = item_data.date access_list = {} if access_model == const.VAL_AMODEL_PUBLISHER_ROSTER: cursor.execute('SELECT groupname FROM item_groups_authorized WHERE item_id=%s', (item_id,)) - access_list[const.OPT_ROSTER_GROUPS_ALLOWED] = [r[0] for r in cursor.fetchall()] + access_list[const.OPT_ROSTER_GROUPS_ALLOWED] = [r.groupname for r in cursor.fetchall()] ret.append(container.ItemData(item, access_model, access_list, date=date)) # TODO: whitelist item access model return ret if ids_only: - return [r[0] for r in result] + return [r.item for r in result] else: - items_data = [container.ItemData(generic.stripNamespace(parseXml(r[0])), r[1], r[2], date=r[3]) for r in result] + items_data = [container.ItemData(generic.stripNamespace(parseXml(r.data)), r.access_model, date=r.date) for r in result] return items_data def getItemsById(self, authorized_groups, unrestricted, itemIdentifiers):