diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-04-17 20:34:41 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-04-17 20:34:41 +0300 |
commit | 37d3720edd2a052e7a0e8b180a0aa7a64355c95b (patch) | |
tree | 675a5a42e596b249f14a3187a11b7a3f51565fc8 | |
parent | b5e3525ce731760b1e719ed3cf7bd4fbf4200c3b (diff) | |
download | mailman-37d3720edd2a052e7a0e8b180a0aa7a64355c95b.tar.gz mailman-37d3720edd2a052e7a0e8b180a0aa7a64355c95b.tar.bz2 |
Fix state saving in mailsync
* bin/mailsync (save_state): Don't increment n
(mboxtohtml): Use len() to get count of messages.
-rwxr-xr-x | bin/mailsync | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/bin/mailsync b/bin/mailsync index 00e6d2c..a3b7308 100755 --- a/bin/mailsync +++ b/bin/mailsync | |||
@@ -94,7 +94,7 @@ def save_state(listid,n): | |||
94 | file = absdir(conf['core']['htmlrootdir'] + "/" + listid + "/.state") | 94 | file = absdir(conf['core']['htmlrootdir'] + "/" + listid + "/.state") |
95 | try: | 95 | try: |
96 | with open(file, 'w') as f: | 96 | with open(file, 'w') as f: |
97 | f.write(str(n + 1) + "\n") | 97 | f.write(str(n) + "\n") |
98 | except IOError: | 98 | except IOError: |
99 | print("cannot write %s: %s" % (file,sys.exc_info()), file=sys.stderr) | 99 | print("cannot write %s: %s" % (file,sys.exc_info()), file=sys.stderr) |
100 | status = EX_FAILURE | 100 | status = EX_FAILURE |
@@ -125,7 +125,6 @@ def mboxtohtml(listid): | |||
125 | n = get_state(listid) | 125 | n = get_state(listid) |
126 | t = 0 | 126 | t = 0 |
127 | for message in inbox.values()[n:]: | 127 | for message in inbox.values()[n:]: |
128 | n += 1 | ||
129 | frm = message.get_from() | 128 | frm = message.get_from() |
130 | s = frm.split(' ', 1) | 129 | s = frm.split(' ', 1) |
131 | t = strptime(s[1], '%a %b %d %H:%M:%S %Y') | 130 | t = strptime(s[1], '%a %b %d %H:%M:%S %Y') |
@@ -159,7 +158,7 @@ def mboxtohtml(listid): | |||
159 | print("\"%s\": %s" % (str(cmd), err), file=sys.stderr) | 158 | print("\"%s\": %s" % (str(cmd), err), file=sys.stderr) |
160 | status = EX_FAILURE | 159 | status = EX_FAILURE |
161 | 160 | ||
162 | save_state(listid, n) | 161 | save_state(listid, len(inbox)) |
163 | if t > 0: | 162 | if t > 0: |
164 | save_timestamp(listid, t) | 163 | save_timestamp(listid, t) |
165 | 164 | ||