Projet

Général

Profil

Bug #25314

crash parse_date si l'entrée n'est pas string or buffer

Ajouté par Thomas Noël il y a presque 6 ans. Mis à jour il y a plus de 5 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
17 juillet 2018
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:

Description

/home/thomas/dev/publik/src/wcs/wcs/qommon/templatetags/qommon.pyc in parse_date(date_string)
     35     # fallback to Django function
     36     try:
---> 37         return dateparse.parse_date(date_string)
     38     except ValueError:
     39         return None

/home/thomas/dev/publik/venv/lib/python2.7/site-packages/django/utils/dateparse.pyc in parse_date(value)
     58     Returns None if the input isn't well formatted.
     59     """ 
---> 60     match = date_re.match(value)
     61     if match:
     62         kw = {k: int(v) for k, v in six.iteritems(match.groupdict())}

TypeError: expected string or buffer

à aligner avec le code de Combo qui fait un except (ValueError, TypeError) pour ne pas crasher


Fichiers

Révisions associées

Révision 08f59072 (diff)
Ajouté par Thomas Noël il y a presque 6 ans

templatetags: handle empty strings for date and time parsers (#25314)

Historique

#2

Mis à jour par Thomas Noël il y a presque 6 ans

#3

Mis à jour par Frédéric Péters il y a presque 6 ans

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

Ok.

#4

Mis à jour par Thomas Noël il y a presque 6 ans

  • Statut changé de Solution validée à Résolu (à déployer)
commit 08f590726d9ee63215cb83f69c195163c7a58ff9
Author: Thomas NOEL <tnoel@entrouvert.com>
Date:   Tue Jul 17 12:15:50 2018 +0200

    templatetags: handle empty strings for date and time parsers (#25314)

#5

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

Formats disponibles : Atom PDF