public inbox for [email protected]
help / color / mirror / Atom feedFrom: Célestin Matte <[email protected]>
To: PostgreSQL WWW <[email protected]>
Subject: [PATCH] pgarchives: pglister_sync: import lists with subscriber_access set to True
Date: Fri, 28 Jan 2022 18:37:37 +0100
Message-ID: <[email protected]> (raw)
pglister_sync.py is a script used to synchronize things between pglister and pgarchives: lists, subscribers etc.
subscriber_access is not set in pglister_sync's query, and is set to null=False in Django's model. As a consequence, pglister_sync fails to add new lists:
Traceback (most recent call last):
File "/srv/pgarchives/local/loader/pglister_sync.py", line 68, in <module>
'groupname': l['group']['groupname'],
psycopg2.errors.NotNullViolation: null value in column "subscriber_access" violates not-null constraint
DETAIL: Failing row contains (8, test-pglister-sync, test-pglister-sync, , t, 1, null).
I don't know if there is a way to configure postgres to use the default value , but I think it would be wiser to explicitly set this variable in pglister_sync.py.
By default, subscriber_access is set to False and there is no way to modify that within the web interface.
As a consequence, access to lists on private servers is restricted to superusers, and there is no easier way to modify that than to edit the database manually.
It seems more logical to me that this value be set to True by default, as access can still be moderated to avoid lists being publicly available.
That said, it may be better to have a way to modify that within the web interface in pglister.
--
Célestin Matte
Attachments:
[text/x-patch] 0001-pglister_sync-import-lists-with-subscriber_access-se.patch (1.2K, 2-0001-pglister_sync-import-lists-with-subscriber_access-se.patch)
download | inline diff:
From 6e93f0e3d5ae297a3ce61e238708b7235acf9084 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9lestin=20Matte?= <[email protected]>
Date: Mon, 1 Nov 2021 20:43:51 +0100
Subject: [PATCH] pglister_sync: import lists with subscriber_access set to
True
Otherwise, there is no in-app way to set it
---
loader/pglister_sync.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/loader/pglister_sync.py b/loader/pglister_sync.py
index f95d369..dd5bec4 100755
--- a/loader/pglister_sync.py
+++ b/loader/pglister_sync.py
@@ -60,7 +60,7 @@ if __name__ == "__main__":
'name': l['listname'],
})
if curs.rowcount == 0:
- curs.execute("INSERT INTO lists (listname, shortdesc, description, active, groupid) SELECT %(name)s, %(name)s, %(desc)s, 't', groupid FROM listgroups WHERE groupname=%(groupname)s RETURNING listid, listname", {
+ curs.execute("INSERT INTO lists (listname, shortdesc, description, active, groupid, subscriber_access) SELECT %(name)s, %(name)s, %(desc)s, 't', groupid, 't' FROM listgroups WHERE groupname=%(groupname)s RETURNING listid, listname", {
'name': l['listname'],
'desc': l['longdesc'],
'groupname': l['group']['groupname'],
--
2.34.1
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: [PATCH] pgarchives: pglister_sync: import lists with subscriber_access set to True
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox