ssato / python-anyconfig

Python library provides common APIs to load and dump configuration files in various formats
MIT License
277 stars 31 forks source link

Fix for properties backend which was rstripping valid values after comment markers #50

Closed ajays20078 closed 7 years ago

ajays20078 commented 8 years ago

The for loop beginning here rstrips the rest of the line once it encounters # or !(comment markers) . This is invalid as per wiki for properties file. Any comment markers which is in property value is considered as part of the value itself(Refer to the message = key in the wiki.

And since the line starting with # or ! (comment markers) are already removed here, there is no need for the for loop which makes it non-compliant with properties format.

ssato commented 7 years ago

You're absolutely right. I had been misunderstood the definition of comments in properties files.

A comment line has an ASCII '#' or '!' as its first non-white space character

[https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#load-java.io.Reader-]

It's almost ready to merge, but could you please update related test cases also to avoid test failures? At least both werker and travis-ci warned about them.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.03%) to 97.607% when pulling 4a70a8d296af4730ffd62a6512667b64c27db107 on ajays20078:master into 6450527e5691652ff2cafac94e9a39c6bcc087ab on ssato:master.

ajays20078 commented 7 years ago

Modified the test cases for the same. Travis is all good now. And the errors in wercker are un-related to this PR.

ssato commented 7 years ago

LGTM. Thanks a lot for the fix!