include ("import") func load_file() if (not isset(cp)) var(cp) println(conf, ' = ConfigParser.SafeConfigParser()') println(conf, '.read(', str(FileName), ')') end end func save_file() if (isset(cp)) println('with open(' && str(FileName) && ', u"wb") as configfile:') block.inclvl() println(cp && '.write(configfile)') block.declvl() end end func doRead(_data) need_conf() load_file() fvar(s) s = conf + '.get(' + Secton + ', ' + Key + ')' if (linked(ValueRead)) println(res, ' = ', s) event(onRead, res) else event(onRead, s) end end func doWrite(_data) need_conf() load_file() fvar(s) println('try:') block.inclvl() println(conf, '.set(', Secton, ', ', Key, ', str(', Value, '))') block.declvl() println('except NoSectionError:') block.inclvl() println(conf, '.addsection(', Section, ')') println(conf, '.set(', Secton, ', ', Key, ', str(', Value, '))') block.declvl() println('') end func doSectionNames(_data) need_conf() load_file() println('for ', sect, ' in ', conf, '.sections():') block.inclvl() event (onSectionNames, item) block.declvl() end func doSectionData(_data) need_conf() load_file() println('for ', data, ' in ', conf, '.items(', Section, '):') block.inclvl() event (onSectionData, data) block.declvl() end func doDeleteKey(_data) need_conf() load_file() println(conf, '.remove_option(', Section, ', ', Key, ')') end func doEraseSection(_data) need_conf() load_file() println(conf, '.remove_section(', Section, ')') end func ValueRead(_data) if (linked(doRead)) return res end end