public inbox for [email protected]
help / color / mirror / Atom feed[PATCH] pglister: load_subscribers.py: don't wait for user input when there is nothing to commit
2+ messages / 2 participants
[nested] [flat]
* [PATCH] pglister: load_subscribers.py: don't wait for user input when there is nothing to commit
@ 2021-11-03 19:01 Célestin Matte <[email protected]>
2021-11-04 11:50 ` Re: [PATCH] pglister: load_subscribers.py: don't wait for user input when there is nothing to commit Magnus Hagander <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Célestin Matte @ 2021-11-03 19:01 UTC (permalink / raw)
To: [email protected]
--
Célestin Matte
Attachments:
[text/x-patch] 0001-load_subscribers.py-don-t-wait-for-user-input-when-t.patch (1.4K, 2-0001-load_subscribers.py-don-t-wait-for-user-input-when-t.patch)
download | inline diff:
From 05e778e77f3a33b66626bf3668eca4c899c22a0b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9lestin=20Matte?= <[email protected]>
Date: Wed, 3 Nov 2021 10:56:41 +0100
Subject: [PATCH] load_subscribers.py: don't wait for user input when there is
nothing to commit
---
bin/load_subscribers.py | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/bin/load_subscribers.py b/bin/load_subscribers.py
index 2b894bf..62e2be1 100755
--- a/bin/load_subscribers.py
+++ b/bin/load_subscribers.py
@@ -104,15 +104,18 @@ if __name__ == "__main__":
})
newsub += curs.rowcount
- while True:
- r = input('Added %s subscribers, of which %s were new. Commit? ' % (newsub, newaddr)).strip().lower()
- if r == 'y':
- break
- elif r == 'n':
- print("OK, aborting")
- conn.rollback()
- sys.exit(1)
- print("OK, committing")
- conn.commit()
+ if newaddr > 0:
+ while True:
+ r = input('Added %s subscribers, of which %s were new. Commit? ' % (newsub, newaddr)).strip().lower()
+ if r == 'y':
+ break
+ elif r == 'n':
+ print("OK, aborting")
+ conn.rollback()
+ sys.exit(1)
+ print("OK, committing")
+ conn.commit()
+ else:
+ print("No new subscriber, nothing to do.")
print("Done.")
conn.close()
--
2.33.1
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [PATCH] pglister: load_subscribers.py: don't wait for user input when there is nothing to commit
2021-11-03 19:01 [PATCH] pglister: load_subscribers.py: don't wait for user input when there is nothing to commit Célestin Matte <[email protected]>
@ 2021-11-04 11:50 ` Magnus Hagander <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Magnus Hagander @ 2021-11-04 11:50 UTC (permalink / raw)
To: Célestin Matte <[email protected]>; +Cc: [email protected]
On Wed, Nov 3, 2021 at 8:01 PM Célestin Matte <[email protected]>
wrote:
>
> --
> Célestin Matte
LGTM. Patch applied, thanks!
--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/;
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2021-11-04 11:50 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03 19:01 [PATCH] pglister: load_subscribers.py: don't wait for user input when there is nothing to commit Célestin Matte <[email protected]>
2021-11-04 11:50 ` Magnus Hagander <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox