[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.
This commit is contained in:
Xavier Morel 2024-11-18 14:49:17 +01:00
parent 63a0ee90b2
commit 4563fc5fc0

View File

@ -4,6 +4,7 @@ from __future__ import annotations
import base64 import base64
import collections import collections
import colorsys import colorsys
import datetime
import hashlib import hashlib
import io import io
import json import json
@ -160,7 +161,7 @@ def raster_render(pr):
# last-modified should be in RFC2822 format, which is what # last-modified should be in RFC2822 format, which is what
# email.utils.formatdate does (sadly takes a timestamp but...) # email.utils.formatdate does (sadly takes a timestamp but...)
last_modified = formatdate(max(( last_modified = formatdate(max((
o.write_date o.write_date or datetime.datetime.min
for o in chain( for o in chain(
project, project,
repos, repos,