Projet

Général

Profil

0001-get_with_indexed_value-is-now-an-iterator-23551.patch

Thomas Noël, 03 mai 2018 11:38

Télécharger (3,82 ko)

Voir les différences:

Subject: [PATCH] get_with_indexed_value is now an iterator (#23551)

 auquotidien/modules/abelium_domino_synchro.py | 3 ++-
 auquotidien/modules/myspace.py                | 8 ++++----
 auquotidien/modules/payments_ui.py            | 8 ++++----
 3 files changed, 10 insertions(+), 9 deletions(-)
auquotidien/modules/abelium_domino_synchro.py
123 123
            if getattr(payment_invoice, 'domino_knows_its_paid', None) or getattr(payment_invoice, 'paid_by_domino', None):
124 124
                # synchronization of payment already done, skip
125 125
                continue
126
            transactions = Transaction.get_with_indexed_value('invoice_ids', payment_invoice.id)
126
            transactions = list(Transaction.get_with_indexed_value('invoice_ids',
127
                                                                   payment_invoice.id))
127 128
            if not transactions:
128 129
                logger.warning("domino cron: invoice %s is marked paid but does "
129 130
                        "not have any linked transaction.", payment_invoice.id)
auquotidien/modules/myspace.py
136 136

  
137 137
        # TODO: a paragraph of explanations here could be useful
138 138

  
139
        sffiles = StrongboxItem.get_with_indexed_value(
140
                        str('user_id'), str(get_request().user.id))
139
        sffiles = list(StrongboxItem.get_with_indexed_value(
140
                        str('user_id'), str(get_request().user.id)))
141 141
        if sffiles:
142 142
            r += htmltext('<table id="strongbox-items">')
143 143
            r += htmltext('<tr><th></th><th>%s</th><th>%s</th><th></th></tr>') % (
......
332 332
            return self.picked_file()
333 333
        r = TemplateIO(html=True)
334 334
        root_url = get_publisher().get_root_url()
335
        sffiles = StrongboxItem.get_with_indexed_value(
336
                        str('user_id'), str(get_request().user.id))
335
        sffiles = list(StrongboxItem.get_with_indexed_value(
336
                        str('user_id'), str(get_request().user.id)))
337 337
        r += htmltext('<h2>%s</h2>') % _('Pick a file')
338 338

  
339 339
        if not sffiles:
auquotidien/modules/payments_ui.py
360 360

  
361 361
    def get_invoices(self):
362 362
        sort_by = self.get_sort_by()
363
        invoices = Invoice.get_with_indexed_value('regie_id', self.regie.id,
364
                ignore_errors=True)
363
        invoices = list(Invoice.get_with_indexed_value('regie_id', self.regie.id,
364
                ignore_errors=True))
365 365
        if 'date' in sort_by:
366 366
            reverse = True
367 367
            key = lambda i: getattr(i, sort_by) or datetime.datetime.now()
......
456 456
            r += htmltext('</form>')
457 457

  
458 458
            r += htmltext('</td></tr>')
459
            transactions = Transaction.get_with_indexed_value('invoice_ids',
460
                    invoice.id)
459
            transactions = list(Transaction.get_with_indexed_value('invoice_ids',
460
                    invoice.id))
461 461
            for transaction in sorted(transactions, key=lambda x: x.start):
462 462
                r += htmltext('<tr>')
463 463
                r += htmltext('<td></td>')
464
-