Hello,
I use configobj and validate to store configurations in Gaupol [1]. One
of the things saved in the configuration file is a list of patterns the
user has searched for. I just noticed that if the user searches for
"#", the string gets saved in the configuration file with no escaping or
quoting and upon reading seems to be interpreted as an in-line comment.
This is especially problematic if "#" is the first item in the list, in
which case the value is interpreted as an empty string instead of an
empty list!
I think the following patch to the "_quote" method should fix that.
--- configobj.orig.py 2007-07-16 02:18:27.000000000 +0300
+++ configobj.py 2007-07-16 02:20:46.000000000 +0300
@@ -1674,7 +1674,7 @@
value)
elif ((value[0] not in wspace_plus) and
(value[-1] not in wspace_plus) and
- (',' not in value)):
+ (',' not in value) and ('#' not in value)):
quot = noquot
else:
if ("'" in value) and ('"' in value):
[1] http://home.gna.org/gaupol/
Thanks,
Osmo Salomaa
|