From 4563fc5fc062507c7d451096438b58c6275aa2d8 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 18 Nov 2024 14:49:17 +0100 Subject: [PATCH] [FIX] runbot_merge: dashboard image is branch created via SQL If a branch is created via SQL directly, one might forget to set its `write_date`, leading the computation of the `last_modified` to be *really* unhappy as it's asked to compare a bunch of datetime objects to `False` in order to compute the `max`. Substitute missing `write_date` with `datetime.min` so they are extremely unlikely to influence the computation until and unless the branch gets updated. --- runbot_merge/controllers/dashboard.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runbot_merge/controllers/dashboard.py b/runbot_merge/controllers/dashboard.py index 9cdc55d8..ab484727 100644 --- a/runbot_merge/controllers/dashboard.py +++ b/runbot_merge/controllers/dashboard.py @@ -4,6 +4,7 @@ from __future__ import annotations import base64 import collections import colorsys +import datetime import hashlib import io import json @@ -160,7 +161,7 @@ def raster_render(pr): # last-modified should be in RFC2822 format, which is what # email.utils.formatdate does (sadly takes a timestamp but...) last_modified = formatdate(max(( - o.write_date + o.write_date or datetime.datetime.min for o in chain( project, repos,