[PATCH] Add files specified in the Config object as attachments to bugreports

Vratislav Podzimek vpodzime at redhat.com
Thu Jul 19 11:35:55 UTC 2012


We append the contents of the files specified in the Config object
to the program-name-tb-XXXXX file, but with this patch, they will
also appear as attachments of the bugreport.
---
 meh/handler.py |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meh/handler.py b/meh/handler.py
index befbcf8..9df098c 100644
--- a/meh/handler.py
+++ b/meh/handler.py
@@ -215,6 +215,15 @@ class ExceptionHandler(object):
         tb_item_name = "%s-tb" % self.conf.programName
         params[tb_item_name] = self.exnText
 
+        for fpath in self.conf.fileList:
+            try:
+                with open(fpath, "r") as fobj:
+                    filename = os.path.basename(fpath)
+                    params[filename] = fobj.read()
+            except:
+                #skip files we cannot read
+                continue
+
         accountManager = report.accountmanager.AccountManager()
 
         signature = report.createPythonUnhandledExceptionSignature(**params)
-- 
1.7.10.4



More information about the anaconda-patches mailing list