Ensure pglister_sync includes a value for subscriber_access
authorMagnus Hagander <magnus@hagander.net>
Sun, 30 Jan 2022 12:16:55 +0000 (13:16 +0100)
committerMagnus Hagander <magnus@hagander.net>
Sun, 30 Jan 2022 12:16:55 +0000 (13:16 +0100)
This has a default=False set in the django model, but django does not
propagate that into the database which would cause the insert of new
lists to fail with a not-null-violation.

Spotted by CĂ©lestin Matte

loader/pglister_sync.py

index f95d369b92b7f84c77d17aa6b4fce7b898ff990b..d7e192510fbbe0629c222fa96e0d801b77123fb9 100755 (executable)
@@ -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, 'f' FROM listgroups WHERE groupname=%(groupname)s RETURNING listid, listname", {
                 'name': l['listname'],
                 'desc': l['longdesc'],
                 'groupname': l['group']['groupname'],