[FIX] qemu stats : un « datetime » de trop faisait tomber le menu
Le module importe la CLASSE datetime, pas le module : « datetime.datetime » n'existe donc pas, et l'écran des statistiques sortait sur une AttributeError qui emportait TODO entier. La garde couvre aussi TypeError : un horodatage absent vaut None dans un résumé sans aucune installation, et une statistique ne doit pas décider de la survie du menu. Vérifié : un horodatage valide rend sa date, None et une valeur hors bornes rendent « ? » sans lever. --- EN --- The module imports the datetime CLASS, not the module: « datetime.datetime » therefore does not exist, and the statistics screen exited on an AttributeError that took the whole of TODO with it. The guard also covers TypeError: an absent timestamp is None in a summary with no install at all, and a statistic must not decide whether the menu survives. Checked: a valid timestamp renders its date, None and an out-of-range value render « ? » without raising. Assisted-by: Claude Opus 5
This commit is contained in:
parent
12cef44991
commit
83c0d705c1
1 changed files with 5 additions and 2 deletions
|
|
@ -513,8 +513,11 @@ class QemuMenuMixin:
|
|||
def _qemu_stamp(ts):
|
||||
"""Horodatage court « 2026-08-01 »."""
|
||||
try:
|
||||
return datetime.datetime.fromtimestamp(ts).strftime("%Y-%m-%d")
|
||||
except (OSError, OverflowError, ValueError):
|
||||
return datetime.fromtimestamp(ts).strftime("%Y-%m-%d")
|
||||
except (OSError, OverflowError, TypeError, ValueError):
|
||||
# TypeError : un horodatage absent vaut None dans un résumé sans
|
||||
# aucune installation, et une statistique ne doit pas faire
|
||||
# tomber le menu.
|
||||
return "?"
|
||||
|
||||
def _qemu_stats_vms(self, mon):
|
||||
|
|
|
|||
Loading…
Reference in a new issue