Projet

Général

Profil

Development #38761

crash à l'affichage d'une catégorie

Ajouté par Nicolas Roche (absent jusqu'au 3 avril) il y a environ 4 ans. Mis à jour il y a environ 4 ans.

Statut:
Fermé
Priorité:
Normal
Catégorie:
-
Version cible:
-
Début:
03 janvier 2020
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

Exception:
  type = '<class 'TypeError'>', value = 'sort() takes no positional arguments'

Stack trace (most recent call first):
  File "/home/nroche/src/auquotidien/auquotidien/modules/root.py", line 123, in user_forms
   121             r += htmltext('<ul>')
   122             import pdb; pdb.set_trace()
>  123             forms_by_status_name[status_name].sort(lambda x,y: cmp(x.receipt_time, y.receipt_time))
   124             for f in forms_by_status_name[status_name]:
   125                 if f.formdef.category_id:

Ça me semble lié au passage à python3 (ça ne se produit pas en recette).
cf https://docs.python.org/2/howto/sorting.html#the-old-way-using-the-cmp-parameter
In Python 3, the cmp parameter was removed entirely (as part of a larger effort to simplify and unify the language, eliminating the conflict between rich comparisons and the cmp() magic method).

Je ne sais pas trop depuis quand il y a ce crash.
Je dirais début décembre, car je bidouillais pour mes intégrations graphiques et je pensais que ça venait de moi.


Fichiers

Révisions associées

Révision a9ee9454 (diff)
Ajouté par Nicolas Roche (absent jusqu'au 3 avril) il y a environ 4 ans

myspace: upgrade sort and remove dedicated display form (#38761)

Historique

#1

Mis à jour par Frédéric Péters il y a environ 4 ans

  • virer ce code d'affichage (toute la classe FormsRootDirectory a priori)
  • repérer les autres appels à l'ancienne forme de sort/sorted (myspace.py) et les adapter.
#2

Mis à jour par Nicolas Roche (absent jusqu'au 3 avril) il y a environ 4 ans

Il manque peut-être un test pour

invoices.sort(key=lambda x: (x.regie_id, -x.date))

dites-moi.

#3

Mis à jour par Frédéric Péters il y a environ 4 ans

  • Statut changé de Solution proposée à Solution validée

J'ai tapé une branche avec ton commit + un commit qui fait tourner les tests en python 3 (et s'assure qu'ils tournent correctement), pour moi c'est ok.

#4

Mis à jour par Frédéric Péters il y a environ 4 ans

  • Statut changé de Solution validée à Résolu (à déployer)
commit bb8a29bdc8103b75bd3b6aa402f812ca0886acf2
Author: Frédéric Péters <fpeters@entrouvert.com>
Date:   Fri Jan 17 14:21:42 2020 +0100

    tests: run against Python 3

commit a9ee9454ccc75f391c714205ff5616c79930b827
Author: Nicolas ROCHE <nroche@entrouvert.com>
Date:   Sat Jan 4 14:51:39 2020 +0100

    myspace: upgrade sort and remove dedicated display form (#38761)
#5

Mis à jour par Frédéric Péters il y a environ 4 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF