Fix handling missing MLs DB.

This commit is contained in:
Dominik Pantůček 2025-04-16 21:41:07 +02:00
parent 37b608ab67
commit c06bc95b36
4 changed files with 20 additions and 10 deletions

View file

@ -61,7 +61,8 @@
grantstart grantstop
joined destroyed
feestart feestop
phone))
phone
councilmlstart councilmlstop))
(define ignored-keys '(mail2))
(define known-keys (append mandatory-keys optional-keys))
@ -88,6 +89,9 @@
(feestart fee start)
(feestop fee stop)
(councilmlstart councilml start)
(councilmlstop councilml stop)
))
(define start-stop-markers (map car start-stop-markers-lookup))
@ -114,7 +118,7 @@
(info
,(lambda (mr output key value)
(case key
((student suspend member revision chair council grant fee)
((student suspend member revision chair council grant fee councilml)
(let* ((res (period-markers->cal-periods value))
(ok? (car res))
(periods0 (cadr res))

View file

@ -101,7 +101,7 @@
;; Which version of mailman to use
(define *mailman-version* (make-parameter #f))
(define =mailman-version= 2)
(define =mailman-version= 3)
;; What is the mailman 3 command
(define *mailman3-bin* (make-parameter #f))
@ -112,7 +112,7 @@
;; A string is the default, gets converted to boolean at the end of
;; loading configuration
(define *mailman3-sql* (make-parameter #f))
(define =mailman3-sql= "0")
(define =mailman3-sql= "1")
;; The path to SQLite3 DB file
(define *mailman3-sql-path* (make-parameter #f))

View file

@ -37,7 +37,8 @@
(chicken base)
(chicken format)
sqlite3
configuration)
configuration
(chicken condition))
;; Thread-local parameter to re-use SQLite3 DB handle for subsequent queries
(define *cached-mailman3-db* (make-parameter #f))
@ -55,10 +56,15 @@
;; Returns the list of mailman3 mailinglists by querying te
;; underlying SQLite3 DB directly
(define (list-mailman3-sql-lists)
(let-values (((stmt _)
(prepare (mailman3-db)
"SELECT list_name FROM mailinglist")))
(map-row identity stmt)))
(handle-exceptions
ex
'()
(let ((result
(let-values (((stmt _)
(prepare (mailman3-db)
"SELECT list_name FROM mailinglist")))
(map-row identity stmt))))
result)))
;; Returns a list of email addresses subscribed to given mailinglist
(define (list-mailman3-sql-list-members lst)

View file

@ -114,7 +114,7 @@
(caddr c)))
(brmember-credit mr))
#:border '(((#:right light) ... none) ...))))
((suspend student member council chair revision grant)
((suspend student member council chair revision grant councilml)
(let* ((pdata (cons (list "Since" "Until")
(map
(lambda (p)