diff options
author | Mark Sapiro <mark@msapiro.net> | 2008-12-02 14:37:29 -0800 |
---|---|---|
committer | Mark Sapiro <mark@msapiro.net> | 2008-12-02 14:37:29 -0800 |
commit | 8e33ae27a67549dd2c8e9ed68862df57a2daf122 (patch) | |
tree | f8c8441d0f913fa2aa6f5de6d8861cf80dc2b0b8 /cron/gate_news | |
parent | 9fc928ea049f04810ab9b3d1eaabd162abdefe1d (diff) | |
download | mailman2-8e33ae27a67549dd2c8e9ed68862df57a2daf122.tar.gz mailman2-8e33ae27a67549dd2c8e9ed68862df57a2daf122.tar.xz mailman2-8e33ae27a67549dd2c8e9ed68862df57a2daf122.zip |
If we somehow retrieve a message from the newsgroup with no headers,
skip trying to post it to the list.
Make sure we always update the watermark even if the message is empty
or unparseable.
Diffstat (limited to 'cron/gate_news')
-rwxr-xr-x | cron/gate_news | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cron/gate_news b/cron/gate_news index a44257cd..9eea84ce 100755 --- a/cron/gate_news +++ b/cron/gate_news @@ -131,6 +131,9 @@ def poll_newsgroup(mlist, conn, first, last, glock): glock.refresh() try: headers = conn.head(`num`)[3] + # I don't know how this happens, but skip an empty message. + if not headers: + raise _ContinueLoop found_to = 0 beenthere = 0 for header in headers: @@ -184,9 +187,12 @@ def poll_newsgroup(mlist, conn, first, last, glock): syslog('fromusenet', str(e)) except _ContinueLoop: continue - # Even if we don't post the message because it was seen on the - # list already, update the watermark - mlist.usenet_watermark = num + # Even if we don't post the message because it was seen on the + # list already, or if we skipped it as unparseable or empty, + # update the watermark. Note this used to be in the 'for' block + # but if the last message(s) raised _ContinueLoop, they wouldn't + # update the watermark. + mlist.usenet_watermark = num |