[mhonarc] seek when needed and add some comments
- From: Olav Vitters <ovitters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mhonarc] seek when needed and add some comments
- Date: Wed, 13 Feb 2013 12:36:14 +0000 (UTC)
commit d6945a67b08c7a20f3cc98531a7fd39360797d52
Author: Olav Vitters <olav vitters nl>
Date: Wed Feb 13 13:36:11 2013 +0100
seek when needed and add some comments
archive.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/archive.py b/archive.py
index 3569ebe..448d6ea 100755
--- a/archive.py
+++ b/archive.py
@@ -115,6 +115,7 @@ class Archiver:
def determine_received_time(self, fd):
"""Determines the received time of a message"""
+ fd.seek(0)
msg = email.message_from_file(fd)
received_texts = msg.get_all('received')
if received_texts is None:
@@ -196,10 +197,9 @@ class Archiver:
sys.stdout.write(line)
if msg.tell():
- msg.seek(0)
-
archivepath = self.handle_message(msg, newmsgs, archivepath)
+ # msg has been handled, clear it for the next
msg.seek(0)
msg.truncate(0)
else:
@@ -207,9 +207,12 @@ class Archiver:
msg.write(line)
+ # End of file: handle existing message, if any
if msg.tell():
archivepath = self.handle_message(msg, newmsgs, archivepath)
+ # If archivepath is set, likely a message has been archived
+ # in which case the index has to be updated
if archivepath:
Archiver.make_index(self.listname, self.private)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]