-
Notifications
You must be signed in to change notification settings - Fork 52
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
Fixes #44 #87 #71 #88
Conversation
Replace propor layer.name() with an xml compliant ascii version of it
Keeps UTF-8 characters
Very nice job. Look like it is breaking the CI build, though. Not sure it's related to this change, can you confirm? |
@volaya The CI was already broken. Maybe we need some help from @elpaso to review the test environment. This PR does not break any tests in my local environment. I didn't added any additional test to guarantee that layer names and styles are properly handled by the plugin. It is just a matter of using UTF-8 identifiers in the layers and styles used in the tests. I can add them later, because we still need to fix #70. |
I've added WIP to the PR title. |
These fixes depends on https://github.com/boundlessgeo/gsconfig/pull/175 |
The CI is not working at the moment, it requires some extra setup, so I am mergin this anyway, since it looks safe and it has been here for too long Thanks! |
countdown ;) |
This fixes bugs #44 #87 #71
Problem #44
This problem is related with SLDs where the layer name is not a valid XML identifier.
To reproduce the error, let us change one layer name, for example, with something like
Città Metropolitana
.The layer will not be properly uploaded to Geoserver because the style upload will fail.
The style is uploaded with two different Geoserver API calls.
First call
The first call always works, because it uses the
name
defined in the interface by the user or suggested by the plugin.The name suggested by the plugin is in this case
Citta_Metropolitana
(returned byxmlNameFixUp
).Second call
The second call will upload the SLD style. As it is now, the sld is returned by
getGsCompatibleSld
, which is not aware of a alternative layer name.The SLD will be:
The upload will fail is this case, because
<NamedLayer>
must be a existing layer in Geoserver.Solution
To make sure that the SLD
<NamedLayer>
is equal to the previous name used in the first API call, we can make a string replacement in the generated SLD.The previous SLD will be:
The upload of the SLD will succeed.
Discussion
In this PR, I've changed
xmlNameFixUp
to:Geoserver accepts and handles stores and styles with UFT-8 names. The name
Città_Metropolitana
is a valid identifier in Geoserver.But if we use UTF-8 names for layers or styles, the plugin will break, bug #70
Since we need to rewrite the entire plugin for QGIS 3 and Python 3, we can postpone UTF-8 identifies support for the next major release.