xfconf: remove bogus string sanitisation
This commit is contained in:
parent
28f1dbb4a1
commit
961180dab1
|
@ -80,14 +80,12 @@ class Xfconf:
|
||||||
prop_type = Xfconf.convert_type(prop_type)
|
prop_type = Xfconf.convert_type(prop_type)
|
||||||
if not prop_type:
|
if not prop_type:
|
||||||
return False
|
return False
|
||||||
value = Xfconf.sanitize_str(value)
|
|
||||||
output = self.xq(["-c", channel, "-p", prop, "-n",
|
output = self.xq(["-c", channel, "-p", prop, "-n",
|
||||||
"-t", prop_type, "-s", value])
|
"-t", prop_type, "-s", value])
|
||||||
return output == ""
|
return output == ""
|
||||||
|
|
||||||
def update_property(self, channel, prop, value):
|
def update_property(self, channel, prop, value):
|
||||||
"""Update an existing property, return True on success."""
|
"""Update an existing property, return True on success."""
|
||||||
value = Xfconf.sanitize_str(value)
|
|
||||||
output = self.xq(["-c", channel, "-p", prop, "-s", value])
|
output = self.xq(["-c", channel, "-p", prop, "-s", value])
|
||||||
return output == ""
|
return output == ""
|
||||||
|
|
||||||
|
@ -102,7 +100,7 @@ class Xfconf:
|
||||||
subtype = Xfconf.convert_type(value["type"])
|
subtype = Xfconf.convert_type(value["type"])
|
||||||
if not subtype:
|
if not subtype:
|
||||||
return False
|
return False
|
||||||
subvalue = Xfconf.sanitize_str(value["value"])
|
subvalue = value["value"]
|
||||||
command += ["-t", subtype, "-s", subvalue]
|
command += ["-t", subtype, "-s", subvalue]
|
||||||
output = self.xq(command)
|
output = self.xq(command)
|
||||||
return output == ""
|
return output == ""
|
||||||
|
@ -129,14 +127,6 @@ class Xfconf:
|
||||||
print(f"Unknown gtype {gtype}.")
|
print(f"Unknown gtype {gtype}.")
|
||||||
return xq_type
|
return xq_type
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def sanitize_str(value):
|
|
||||||
"""Wrap value with doublequotes if it contains whitespaces."""
|
|
||||||
for char in string.whitespace:
|
|
||||||
if char in value:
|
|
||||||
return f'"{value}"'
|
|
||||||
return value
|
|
||||||
|
|
||||||
|
|
||||||
XION_PROP_RE = re.compile(r"t:(\S+) (.+)")
|
XION_PROP_RE = re.compile(r"t:(\S+) (.+)")
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,8 @@ class Xion:
|
||||||
if confirm and input("Confirm? [y/N]") != "y":
|
if confirm and input("Confirm? [y/N]") != "y":
|
||||||
print("Operation cancelled.")
|
print("Operation cancelled.")
|
||||||
return False
|
return False
|
||||||
if replace and not self.clear_tree(channel, root):
|
if replace:
|
||||||
|
if not self.clear_tree(channel, root):
|
||||||
print("Failed to clear properties.")
|
print("Failed to clear properties.")
|
||||||
return False
|
return False
|
||||||
for prop, content in tree.items():
|
for prop, content in tree.items():
|
||||||
|
|
Loading…
Reference in a new issue