[pyatspi2] Handle match rules with multiple attribute values associated with a key
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pyatspi2] Handle match rules with multiple attribute values associated with a key
- Date: Sun, 15 Sep 2013 17:00:27 +0000 (UTC)
commit 8841c9eb9f9e740184a8fcdc145169b1cbd0f29f
Author: Mike Gorse <mgorse suse com>
Date: Sun Sep 15 11:51:07 2013 -0500
Handle match rules with multiple attribute values associated with a key
Specifying multiple attribute strings with a given key, with the
intention of accepting any of a specified set of values, would result in
the last specified string overriding previous ones. Instead, delimit
values with a :, and also allow a : in a string to be escaped with a \.
(Another approach would have been to have libatspi allow creation of a
match rule from a list, rather than a hash, but trying to avoid an API
change, especially when we're in API freeze).
https://bugzilla.gnome.org/show_bug.cgi?id=700865
pyatspi/utils.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/pyatspi/utils.py b/pyatspi/utils.py
index 8a2ceed..c7a5705 100644
--- a/pyatspi/utils.py
+++ b/pyatspi/utils.py
@@ -339,7 +339,11 @@ def attributeListToHash(list):
ret = dict()
for item in list:
[key, val] = item.split(":")
- ret[key] = val
+ val = val.replace(":", "\:")
+ if ret.__contains__(key):
+ ret[key] = ret[key] + ":" + val
+ else:
+ ret[key] = val
return ret
def hashToAttributeList(h):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]