buckket / twtxt

Decentralised, minimalist microblogging service for hackers.
http://twtxt.readthedocs.org/en/stable/
MIT License
1.91k stars 79 forks source link

Config update removes comments #86

Closed kdave closed 8 years ago

kdave commented 8 years ago

After eg. the follow command, the config gets rewritten and all comments are lost. In my case it was a commented out value of a variable when I did a quick-test of different value. Would be good to preserve the comments or document that they could get removed.

buckket commented 8 years ago

That’s basically the default behaviour of Python’s configparser module. I don’t see a way to change that, without having to write additional code. So as it stands: Don’t except comments to survive in twtxt’s config file. :ghost:

But maybe someone else knows a way?

timofurrer commented 8 years ago

I had a quick look at the configparser implementation. There is no built-in way to preserve the comments. The only way I see would be to subclass from configparser.ConfigParser and overwrite the read and write methods. I don't think it's worth to do that ...

buckket commented 8 years ago

@timofurrer Yes, that’s what I was thinking about as well.

So best solution seems to be mentioning it somewhere in the docs that comments aren't preserved.

timofurrer commented 8 years ago

Yeah, I can make this change.

buckket commented 8 years ago

@timofurrer Thanks!