summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Westman <james@flyingpimonster.net>2020-08-17 17:11:29 -0500
committerJames Westman <james@flyingpimonster.net>2020-08-29 16:14:24 -0500
commit9215f2b196529a24e7b4920a25a8a9fa9a41941d (patch)
treef0a02945f3c90d9e6a023ad8eea19a26d081282d
parentf12c17970239d810f6c6b02e3e504dec861c458f (diff)
downloadd-feet-9215f2b196529a24e7b4920a25a8a9fa9a41941d.tar.gz
Escape markup in property values
This fixes an issue where property values that contained markup characters weren't displayed. Fixes #8.
-rw-r--r--src/dfeet/introspection_helper.py4
-rwxr-xr-xsrc/tests/tests.py.in2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/dfeet/introspection_helper.py b/src/dfeet/introspection_helper.py
index 74789f5..13dfee6 100644
--- a/src/dfeet/introspection_helper.py
+++ b/src/dfeet/introspection_helper.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-from gi.repository import GObject, Gio
+from gi.repository import GLib, GObject, Gio
from dfeet import dbus_utils
@@ -87,7 +87,7 @@ class DBusProperty(DBusInterface):
args_signature_markup(sig),
args_name_markup(self.property_info.name), " / ".join(readwrite))
if self.value is not None:
- s += " = %s" % (self.value,)
+ s += " = %s" % (GLib.markup_escape_text(str(self.value), -1),)
return s
@property
diff --git a/src/tests/tests.py.in b/src/tests/tests.py.in
index de40cf3..d508baf 100755
--- a/src/tests/tests.py.in
+++ b/src/tests/tests.py.in
@@ -74,7 +74,7 @@ class IntrospectionHelperTest(unittest.TestCase):
# get the markup string with value for struct prop (see bgo #702593)
obj_prop = DBusProperty(obj_iface, obj_iface.iface_info.properties[2])
obj_prop.value = ("string", 1, 2)
- self.assertIn("'string', 1, 2", obj_prop.markup_str)
+ self.assertIn("&apos;string&apos;, 1, 2", obj_prop.markup_str)
def test_dbus_signal(self):
"""test DBusSignal class"""