Write an .ini-format representation of the configuration state.
(self, fp)
| 213 | """ |
| 214 | |
| 215 | def write(self, fp): |
| 216 | """ |
| 217 | Write an .ini-format representation of the configuration state. |
| 218 | """ |
| 219 | |
| 220 | if self._defaults: |
| 221 | fp.write("[%s]\n" % _configparser.DEFAULTSECT) |
| 222 | |
| 223 | for (key, value) in self._defaults.items(): |
| 224 | fp.write("%s = %s" % (key, getUnicode(value, UNICODE_ENCODING))) |
| 225 | |
| 226 | fp.write("\n") |
| 227 | |
| 228 | for section in self._sections: |
| 229 | fp.write("[%s]\n" % section) |
| 230 | |
| 231 | for (key, value) in self._sections[section].items(): |
| 232 | if key != "__name__": |
| 233 | if value is None: |
| 234 | fp.write("%s\n" % (key)) |
| 235 | elif not isListLike(value): |
| 236 | fp.write("%s = %s\n" % (key, getUnicode(value, UNICODE_ENCODING))) |
| 237 | |
| 238 | fp.write("\n") |
| 239 | |
| 240 | class Format(object): |
| 241 | @staticmethod |
no test coverage detected