Blob Blame History Raw
From fe4196bd067e938303ec3cdee7c912e84cea6aa0 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 25 Aug 2015 08:25:19 +0200
Subject: [PATCH] convert all 'ex.message' stmts to 'str(ex)'

Python 3 exceptions do not have the 'message' attribute.
The 'message' attribute has been deprecated since Python 2.6
https://www.python.org/dev/peps/pep-0352/

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
 src/plugins/abrt-action-generate-machine-id |  2 +-
 src/plugins/abrt-action-notify              | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/plugins/abrt-action-generate-machine-id b/src/plugins/abrt-action-generate-machine-id
index 63b5c93..c547d7c 100644
--- a/src/plugins/abrt-action-generate-machine-id
+++ b/src/plugins/abrt-action-generate-machine-id
@@ -110,7 +110,7 @@ def generate_machine_id(generators):
             ids[sd] = workers[sd]()
         except RuntimeError as ex:
             logging.error("Machine-ID generator '{0}' failed: {1}"
-                        .format(sd, ex.message))
+                        .format(sd, str(ex)))
 
     return ids
 
diff --git a/src/plugins/abrt-action-notify b/src/plugins/abrt-action-notify
index 716de45..ca8f807 100644
--- a/src/plugins/abrt-action-notify
+++ b/src/plugins/abrt-action-notify
@@ -116,7 +116,7 @@ def emit_crash_dbus_signal(problem_data):
         bus.send_message(msg)
     except dbus.exceptions.DBusException as ex:
         raise RuntimeError("Failed to emit D-Bus Crash signal: {0}"
-                .format(ex.message))
+                .format(str(ex)))
     finally:
         if bus is not None:
             bus.close()
@@ -213,7 +213,7 @@ if __name__ == "__main__":
         PD = build_notification_problem_data(DIR_PATH)
     except ValueError as ex:
         sys.stderr.write("Cannot notify '{0}': {1}\n".
-                format(DIR_PATH, ex.message))
+                format(DIR_PATH, str(ex)))
         sys.exit(RETURN_FAILURE)
 
     # The execution must continue because we should try to notify via all
@@ -223,13 +223,13 @@ if __name__ == "__main__":
         emit_crash_dbus_signal(PD)
     except RuntimeError as ex:
         sys.stderr.write("Cannot notify '{0}' via D-Bus: {1}\n".
-                format(DIR_PATH, ex.message))
+                format(DIR_PATH, str(ex)))
         return_status = RETURN_FAILURE
     except KeyError as ex:
         # this is a bug in build_notification_problem_data()
         sys.stderr.write("BUG: problem data misses required element '{0}'"
                          " required for D-Bus notification\n"
-                         .format(ex.message))
+                         .format(str(ex)))
 
         return_status = RETURN_FAILURE
 
@@ -247,13 +247,13 @@ if __name__ == "__main__":
                 run_autoreport(PD, event_name)
             except RuntimeError as ex:
                 sys.stderr.write("Cannot notify '{0}' via uReport: {1}\n".
-                        format(DIR_PATH, ex.message))
+                        format(DIR_PATH, str(ex)))
                 return_status = RETURN_FAILURE
             except KeyError as ex:
                 # this is a bug in build_notification_problem_data()
                 sys.stderr.write(
                     "BUG: problem data misses required element '{0}'"
-                    " required for uReport notification\n".format(ex.message))
+                    " required for uReport notification\n".format(str(ex)))
 
                 return_status = RETURN_FAILURE
 
-- 
2.5.0