Commit d32dd904 authored by Yuya Nishihara's avatar Yuya Nishihara

wconfig: patch iniparse to allow :suboption in name

This is necessary to parse [hostsecurity] section.

It isn't nice to modify module's global state, but we already have the call of
iniparse.change_comment_syntax(), so this patch won't make things worse.

branch : stable
parent cb49c58e8731
......@@ -266,6 +266,22 @@ def check_read_write_rem():
c.set('foo', 'rem', 'y')
assert_equals('[foo]\nrem = y', written(c).rstrip())
def check_read_write_suboption():
c = newwconfig()
s = '[foo]\nbar:baz = x''foo', fp=StringIO(s))
c.set('foo', 'bar:baz', 'y')
assert_equals('[foo]\nbar:baz = y', written(c).rstrip())
def check_read_write_suboption_removal():
c = newwconfig()
s = '[foo]\nbar:baz = x\nbar = y''foo', fp=StringIO(s))
del c['foo']['bar:baz']
assert_equals('[foo]\nbar = y', written(c).rstrip())
def check_write_conflict_set_set():
......@@ -28,9 +28,10 @@ if _hasiniparse:
# 'rem' as a comment
CommentLine.regex = re.compile(r'^(?P<csep>[%;#])(?P<comment>.*)$')
# allow :suboption in <name>
from iniparse.ini import OptionLine
OptionLine.regex = re.compile(r'^(?P<name>[^:=\s[][^:=]*)'
OptionLine.regex = re.compile(r'^(?P<name>[^:=\s[][^=]*)'
class _wsortdict(object):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment