From: Michael Tremer Date: Wed, 10 Dec 2025 12:16:00 +0000 (+0000) Subject: lists: Initialize updated_at with the current timestamp X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd5cc0923f2bac58211be78d76526e33769bb5a8;p=dbl.git lists: Initialize updated_at with the current timestamp Signed-off-by: Michael Tremer --- diff --git a/src/database.sql b/src/database.sql index f75331c..4898615 100644 --- a/src/database.sql +++ b/src/database.sql @@ -2,7 +2,7 @@ -- PostgreSQL database dump -- -\restrict iyF1xJX6Rr5HXWxSVy3hc4tk2qFzInuecwfyZcCbdOKUcUhTZab2fHQNbRay16f +\restrict 6nJVr9P5tK3JEHqsf1GqOxn2ArIH0TeeAQGlXEqO2KxOZaX0g6qxzMEPFvsyQVJ -- Dumped from database version 17.6 (Debian 17.6-0+deb13u1) -- Dumped by pg_dump version 17.6 (Debian 17.6-0+deb13u1) @@ -36,7 +36,7 @@ CREATE TABLE public.lists ( deleted_at timestamp with time zone, deleted_by text, license text NOT NULL, - updated_at timestamp with time zone, + updated_at timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL, description text ); @@ -274,5 +274,5 @@ ALTER TABLE ONLY public.sources -- PostgreSQL database dump complete -- -\unrestrict iyF1xJX6Rr5HXWxSVy3hc4tk2qFzInuecwfyZcCbdOKUcUhTZab2fHQNbRay16f +\unrestrict 6nJVr9P5tK3JEHqsf1GqOxn2ArIH0TeeAQGlXEqO2KxOZaX0g6qxzMEPFvsyQVJ diff --git a/src/dnsbl/exporters.py b/src/dnsbl/exporters.py index 4ff304c..28a2339 100644 --- a/src/dnsbl/exporters.py +++ b/src/dnsbl/exporters.py @@ -92,18 +92,9 @@ class TextExporter(Exporter): "", ] - # Add the license lines += [ " License : %s" % self.list.license, - ] - - # Add the update timestamp - if self.list.updated_at: - lines += [ - " Updated : %s" % self.list.updated_at.isoformat(), - ] - - lines += [ + " Updated : %s" % self.list.updated_at.isoformat(), "", " Copyright (C) %s - IPFire Team" % now.strftime("%Y"), "", @@ -169,10 +160,7 @@ class ZoneExporter(TextExporter): zone = dns.zone.Zone(origin) # Make the serial - if self.list.updated_at: - serial = self.list.updated_at.strftime("%s") - else: - serial = "0" + serial = self.list.updated_at.strftime("%s") # Create the SOA soa = dns.rdataset.from_text( diff --git a/src/dnsbl/lists.py b/src/dnsbl/lists.py index efcd96e..7c2e814 100644 --- a/src/dnsbl/lists.py +++ b/src/dnsbl/lists.py @@ -172,7 +172,7 @@ class List(sqlmodel.SQLModel, database.BackendMixin, table=True): self.updated_at = sqlmodel.func.current_timestamp() # Updated At - updated_at : datetime.datetime | None + updated_at : datetime.datetime @functools.cached_property def zone(self):