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

Preserving inline tables #74

Closed
nateprewitt opened this issue Feb 2, 2017 · 3 comments
Closed

Preserving inline tables #74

nateprewitt opened this issue Feb 2, 2017 · 3 comments

Comments

@nateprewitt
Copy link
Contributor

Hey @uiri, are there any plans to support preserving inline tables in the dumps function. If not would you be open to a PR implementing such functionality?

Right now, I have a project with users supplying TOML, often using the inline tables syntax:

value = {extra = ["values",]}

While loads handles this just fine, serializing back to TOML creates a subsection. This is creating maintainability problems, in some cases, since things are moving around in the TOML file unexpectedly. It would be nice if the data structure was written back out as it was ingested, if possible.

Thanks for your consideration!

@uiri
Copy link
Owner

uiri commented Feb 3, 2017 via email

@nateprewitt
Copy link
Contributor Author

I would recommend calling loads with the _dict parameter set to an OrderedDict. This (or another custom dictionary type) might help your issue.

Unfortunately, we're already doing that to no avail.

I would recommend adding a boolean flag to dumps. That way the current behaviour can stay as the default.

Yep, I was thinking a preservation flag for opt in, so it won't affect current users. I'll take a look into setting that up, thanks!

@uiri
Copy link
Owner

uiri commented Mar 30, 2017

Fixed at 87993ce (I believe)

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

2 participants