Changed upload_style so you can alternatively just pass valid XML in place of the path to the file containing the style XML #139
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #116
I finally came back to this half a year later, but I made better changes than what I suggested in the issue.
You can now upload a style just by passing valid XML where you would normally pass the path to the SLD file.
I realize it's a bit janky because the parameter is called
path
, but I'm afraid that changing it might break existing systems that invoke the method via kwargs. But I think the added flexibility is worth it. To briefly re-iterate my issue, I was dynamically building style files on the fly and uploading them, and it was annoying me that I had to save them to a file before uploading them. With this change I (and others) should be able to just pass the style as XML if you don't want to bother writing to disk first.I also wrote a couple tests to confirm that both passing a path to the file works, as does passing an XML string. I also tested that passing a non-existent path, as well as a malformed XML string fails as expected.
Sorry about the bad branch name, originally I was working on making temp files work before I realized that it would be easier to just pass a string.