rss2email: work around pickle.load() messing with LOG.
authorW. Trevor King <wking@tremily.us>
Thu, 18 Oct 2012 16:06:30 +0000 (12:06 -0400)
committerW. Trevor King <wking@tremily.us>
Thu, 18 Oct 2012 16:06:34 +0000 (12:06 -0400)
I'm not sure why this is happening yet, but _pickle.load() is
duplicating the StreamHandlers in LOG and resetting the log level to
ERROR.  Work around that by saving the original level/handlers and
restoring them after the load() call.
I haven't figured out why this happens yet.

rss2email.py

index 886fea5218bd46339f5d82dd4bcef3951aaa03af..cd9fb7176f85a1466a23a2fb4f402ff6b285b401 100755 (executable)
@@ -1341,7 +1341,13 @@ class Feeds (list):
             _fcntl.flock(self._datafile_lock.fileno(), locktype)
 
         self.clear()
-        self.extend(_pickle.load(self._datafile_lock))
+
+        level = LOG.level
+        handlers = list(LOG.handlers)
+        feeds = list(_pickle.load(self._datafile_lock))
+        LOG.setLevel(level)
+        LOG.handlers = handlers
+        self.extend(feeds)
 
         if locktype == 0:
             self._datafile_lock.close()