Bug #15204
Dans le filtre backoffice accepter les dates avec deux chiffres pour l'année
Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
02 mars 2017
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Description
Exception: type = '<type 'exceptions.ValueError'>', value = 'time data '01/02/17' does not match format '%d/%m/%Y'' Stack trace (most recent call first): File "/usr/lib/python2.7/_strptime.py", line 325, in _strptime 323 if not found: 324 raise ValueError("time data %r does not match format %r" % > 325 (data_string, format)) 326 if len(data_string) != found.end(): 327 raise ValueError("unconverted data remains: %s" % locals: found = None format = '%d/%m/%Y' data_string = '01/02/17' format_regex = <_sre.SRE_Pattern object at 0x249fac0> locale_time = <_strptime.LocaleTime object at 0x7f23b0ea2b10> File "/usr/lib/python2.7/_strptime.py", line 467, in _strptime_time 465 466 def _strptime_time(data_string, format="%a %b %d %H:%M:%S %Y"): > 467 return _strptime(data_string, format)[0] locals: data_string = '01/02/17' format = '%d/%m/%Y' File "/usr/lib/python2.7/dist-packages/wcs/backoffice/management.py", line 1125, in get_criterias_from_query 1123 1124 if filter_field.id == 'start': > 1125 period_start = time.strptime(filter_field_value, format_string) 1126 criterias.append(GreaterOrEqual('receipt_time', period_start)) 1127 criterias[-1]._label = '%s: %s' % (_('Start'), filter_field_value) locals: criterias = [] format_string = '%d/%m/%Y' filter_field = <wcs.backoffice.management.FakeField object at 0x7f23a65cced0> period_fake_fields = [<wcs.backoffice.management.FakeField object at 0x7f23a65cced0>, <wcs.backoffice.management.FakeField object at 0x7f23a65cc290>] filter_field_key = 'filter-start-value' filter_fields = [] filter_field_value = '01/02/17' self = <wcs.backoffice.management.FormPage object at 0x7f23b68edb50>
Fichiers
Demandes liées
Révisions associées
Historique
Mis à jour par Frédéric Péters il y a presque 6 ans
- Dupliqué par Bug #24281: sur les listing de traitement, une date «erronnée» dans les critères provoque un crash ajouté
Mis à jour par Frédéric Péters il y a presque 6 ans
- Fichier 0001-backoffice-allow-two-digit-years-in-filters-15204.patch 0001-backoffice-allow-two-digit-years-in-filters-15204.patch ajouté
- Statut changé de Nouveau à En cours
- Patch proposed changé de Non à Oui
Mis à jour par Thomas Noël il y a presque 6 ans
Pas encore testé plus que cela, mais la modif dans misc a une portée plus générale que le simple backoffice, non ? (ce qui n'est pas vraiment un soucis selon moi, tant que ma date de naissance n'est pas vue en 2073 ça me va)
Mis à jour par Frédéric Péters il y a presque 6 ans
Oui il y a une portée générale (par endroit au moins le backoffice utilise DateWidget comme le reste).
Précédemment taper une année en 73 en front affichait "date invalide", ça passe désormais comme étant 1973.
Dans strptime(3) :
%y The year within century (0–99). When a century is not otherwise specified, values in the range 69–99 refer to years in the twentieth century (1969–1999); values in the range 00–68 refer to years in the twenty-first century (2000–2068).
Et ça se trouve pareil en Python.
Mis à jour par Frédéric Péters il y a presque 6 ans
- Statut changé de En cours à Résolu (à déployer)
commit 3c344f4edbc68daf36a96a836eefffadea8bc44d Author: Frédéric Péters <fpeters@entrouvert.com> Date: Sat Jun 9 18:17:54 2018 +0200 backoffice: allow two-digit years in filters (#15204)
Mis à jour par Frédéric Péters il y a plus de 5 ans
- Statut changé de Résolu (à déployer) à Solution déployée
backoffice: allow two-digit years in filters (#15204)