Projet

Général

Profil

0001-backoffice-don-t-get-full-objects-when-looking-for-i.patch

Frédéric Péters, 15 janvier 2020 09:28

Télécharger (1,53 ko)

Voir les différences:

Subject: [PATCH] backoffice: don't get full objects when looking for ids
 (#38966)

 wcs/forms/backoffice.py | 2 +-
 wcs/qommon/storage.py   | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
wcs/forms/backoffice.py
160 160
            item_ids = list(set(item_ids).intersection(query_ids))
161 161

  
162 162
        if criterias:
163
            select_ids = [x.id for x in formdata_class.select(clause=criterias)]
163
            select_ids = formdata_class.keys(clause=criterias)
164 164
            item_ids = list(set(item_ids).intersection(select_ids))
165 165

  
166 166
        if item_ids and not anonymise:
wcs/qommon/storage.py
286 286
        return os.path.join(get_publisher().app_dir, cls.get_table_name())
287 287

  
288 288
    @classmethod
289
    def keys(cls):
289
    def keys(cls, clause=None):
290 290
        if not os.path.exists(cls.get_objects_dir()):
291 291
            return []
292
        if clause:
293
            return [x.id for x in cls.select(clause=clause)]
292 294
        return [fix_key(x) for x in os.listdir(cls.get_objects_dir()) if x[0] != '.']
293 295

  
294 296
    @classmethod
295
-