Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config update removes comments #86

Closed
kdave opened this issue Feb 16, 2016 · 5 comments
Closed

Config update removes comments #86

kdave opened this issue Feb 16, 2016 · 5 comments

Comments

@kdave
Copy link
Contributor

kdave commented Feb 16, 2016

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
Copy link
Owner

buckket commented Feb 16, 2016

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. 👻

But maybe someone else knows a way?

@timofurrer
Copy link
Contributor

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
Copy link
Owner

buckket commented Feb 16, 2016

@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
Copy link
Contributor

Yeah, I can make this change.

@buckket
Copy link
Owner

buckket commented Feb 16, 2016

@timofurrer Thanks!

@buckket buckket closed this as completed Feb 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants