[mhonarc] add more debug output



commit 513c1dbdfdd825a6b59b05a7e94579babc83c713
Author: Olav Vitters <olav vitters nl>
Date:   Wed Feb 13 17:21:39 2013 +0100

    add more debug output

 archive.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/archive.py b/archive.py
index 1fd010b..843b325 100755
--- a/archive.py
+++ b/archive.py
@@ -41,6 +41,9 @@ def human_size(size):
     return fmt % (size/float(lim/2**10), suf)
 
 def get_mailinglist_info(listname):
+    """Get the mailing list description from mailman
+
+    The description is in HTML"""
     try:
         import paths
         from Mailman import MailList
@@ -85,9 +88,13 @@ class Archiver:
     def output(self, newmsgs, archivepath):
         """Call mhonarc to archive all messages contained in newmsgs to archivepath"""
         if archivepath is None:
+            if self.debug:
+                print "ERROR: Cannot archive messages as archivepath has not been defined!"
             return False
 
         try:
+            if self.debug:
+                print "Calling mhonarc for %s" % archivepath
             path = os.path.join(self.PRIVATE_ARCHIVE_DIR, self.listname, archivepath)
 
             # Ensure path actually exists
@@ -202,7 +209,8 @@ class Archiver:
                 if line == "\n":
                     blank = True
                 elif blank and re_from.match(line):
-                    sys.stdout.write(line)
+                    if self.debug:
+                        sys.stdout.write(line)
 
                     if msg.tell():
                         archivepath = self.handle_message(msg, newmsgs, archivepath)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]