Solve InterpolationSyntaxError if "%" in a string
The grampletpane module save data in a config file for all the gramplets added in the dashboard. The python configparser module doesn't like if we have a "%" character in a string. Fixes #012423
This commit is contained in:
parent
f5202a9ab8
commit
8eed6b869a
@ -1239,6 +1239,12 @@ class GrampletPane(Gtk.ScrolledWindow):
|
|||||||
else:
|
else:
|
||||||
cnt = 0
|
cnt = 0
|
||||||
for item in base_opts["data"]:
|
for item in base_opts["data"]:
|
||||||
|
# If we have a "%" in a string,
|
||||||
|
# escape it by writing "%%"
|
||||||
|
# to avoid InterpolationSyntaxError
|
||||||
|
# in python configparser module.
|
||||||
|
if isinstance(item, str):
|
||||||
|
item = item.replace("%", "%%")
|
||||||
fp.write("data[%d]=%s\n" % (cnt, item))
|
fp.write("data[%d]=%s\n" % (cnt, item))
|
||||||
cnt += 1
|
cnt += 1
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user