changeset 1188:bf2927e6a0f5

frontends (dbus): error is not truncated anymore if it's not a SàT error.
author Goffi <goffi@goffi.org>
date Mon, 08 Sep 2014 21:23:21 +0200
parents eb1144a22e20
children 7d640c303140
files frontends/src/bridge/DBus.py src/bridge/bridge_constructor/dbus_frontend_template.py
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/bridge/DBus.py	Mon Sep 08 21:23:18 2014 +0200
+++ b/frontends/src/bridge/DBus.py	Mon Sep 08 21:23:21 2014 +0200
@@ -43,7 +43,11 @@
     @param dbus_e (DBusException)
     @return: BridgeException
     """
-    name = dbus_e.get_dbus_name()[len(const_ERROR_PREFIX) + 1:]
+    full_name = dbus_e.get_dbus_name()
+    if full_name.startswith(const_ERROR_PREFIX):
+        name = dbus_e.get_dbus_name()[len(const_ERROR_PREFIX) + 1:]
+    else:
+        name = full_name
     # XXX: dbus_e.args doesn't contain the original DBusException args, but we
     # receive its serialized form in dbus_e.args[0]. From that we can rebuild
     # the original arguments list thanks to ast.literal_eval (secure eval).
--- a/src/bridge/bridge_constructor/dbus_frontend_template.py	Mon Sep 08 21:23:18 2014 +0200
+++ b/src/bridge/bridge_constructor/dbus_frontend_template.py	Mon Sep 08 21:23:21 2014 +0200
@@ -43,7 +43,11 @@
     @param dbus_e (DBusException)
     @return: BridgeException
     """
-    name = dbus_e.get_dbus_name()[len(const_ERROR_PREFIX) + 1:]
+    full_name = dbus_e.get_dbus_name()
+    if full_name.startswith(const_ERROR_PREFIX):
+        name = dbus_e.get_dbus_name()[len(const_ERROR_PREFIX) + 1:]
+    else:
+        name = full_name
     # XXX: dbus_e.args doesn't contain the original DBusException args, but we
     # receive its serialized form in dbus_e.args[0]. From that we can rebuild
     # the original arguments list thanks to ast.literal_eval (secure eval).