diff options
author | James Westman <james@flyingpimonster.net> | 2020-08-17 17:11:29 -0500 |
---|---|---|
committer | James Westman <james@flyingpimonster.net> | 2020-08-29 16:14:24 -0500 |
commit | 9215f2b196529a24e7b4920a25a8a9fa9a41941d (patch) | |
tree | f0a02945f3c90d9e6a023ad8eea19a26d081282d | |
parent | f12c17970239d810f6c6b02e3e504dec861c458f (diff) | |
download | d-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.py | 4 | ||||
-rwxr-xr-x | src/tests/tests.py.in | 2 |
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("'string', 1, 2", obj_prop.markup_str) def test_dbus_signal(self): """test DBusSignal class""" |