From aea6cc82a2f3b48757374fbe80b22bde886a35f8 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Wed, 21 Mar 2018 14:40:24 +0100 Subject: [PATCH] Only report "updated list n" if it's actually updated --- pgweb/lists/management/commands/sync_lists.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pgweb/lists/management/commands/sync_lists.py b/pgweb/lists/management/commands/sync_lists.py index 15443d0f..53c89633 100644 --- a/pgweb/lists/management/commands/sync_lists.py +++ b/pgweb/lists/management/commands/sync_lists.py @@ -37,12 +37,13 @@ class Command(BaseCommand): l['name'], l['group'], l['active'], l['description'], l['shortdesc'])) print "Added list %s" % l['name'] else: - curs.execute("UPDATE lists_mailinglist SET group_id=(SELECT id FROM lists_mailinglistgroup WHERE groupname=%s), active=%s, description=%s, shortdesc=%s WHERE listname=%s AND NOT (group_id=(SELECT id FROM lists_mailinglistgroup WHERE groupname=%s) AND active=%s AND description=%s AND shortdesc=%s)", ( + curs.execute("UPDATE lists_mailinglist SET group_id=(SELECT id FROM lists_mailinglistgroup WHERE groupname=%s), active=%s, description=%s, shortdesc=%s WHERE listname=%s AND NOT (group_id=(SELECT id FROM lists_mailinglistgroup WHERE groupname=%s) AND active=%s AND description=%s AND shortdesc=%s) RETURNING listname", ( l['group'], l['active'], l['description'], l['shortdesc'], l['name'], l['group'], l['active'], l['description'], l['shortdesc'], )) - print "Updated list %s" % l['name'] + for n, in curs.fetchall(): + print "Updated list %s" % n # Delete any lists that shouldn't exist anymore (this is safe because we don't keep any data about them, # so they are trivial to add back) -- 2.39.5