Skip to content
Permalink
Browse files

Merge pull request #4216 from tomkralidis/issue-16261-2.18

 MetaSearch: clean OWS URL when adding from search #4215
  • Loading branch information
tomkralidis committed Mar 4, 2017
2 parents 4f3719c + 876a84d commit 067df257ddc37b62cfe20e4e52c0809b21313722
Showing with 18 additions and 6 deletions.
  1. +5 −5 python/plugins/MetaSearch/dialogs/maindialog.py
  2. +13 −1 python/plugins/MetaSearch/util.py
@@ -49,10 +49,10 @@
from MetaSearch.dialogs.newconnectiondialog import NewConnectionDialog
from MetaSearch.dialogs.recorddialog import RecordDialog
from MetaSearch.dialogs.xmldialog import XMLDialog
from MetaSearch.util import (get_connections_from_file, get_ui_class,
get_help_url, highlight_xml, normalize_text,
open_url, render_template, serialize_string,
StaticContext)
from MetaSearch.util import (clean_ows_url, get_connections_from_file,
get_ui_class, get_help_url, highlight_xml,
normalize_text, open_url, render_template,
serialize_string, StaticContext)

BASE_CLASS = get_ui_class('maindialog.ui')

@@ -718,7 +718,7 @@ def add_to_ows(self):

# no dups detected or overwrite is allowed
self.settings.beginGroup('/Qgis/connections-%s' % stype[1])
self.settings.setValue('/%s/url' % sname, data_url)
self.settings.setValue('/%s/url' % sname, clean_ows_url(data_url))
self.settings.endGroup()

# open provider window
@@ -40,7 +40,7 @@
from pygments import highlight
from pygments.lexers import XmlLexer
from pygments.formatters import HtmlFormatter
from qgis.PyQt.QtCore import QSettings
from qgis.PyQt.QtCore import QSettings, QUrl
from qgis.PyQt.QtWidgets import QMessageBox
from qgis.PyQt.uic import loadUiType

@@ -167,3 +167,15 @@ def serialize_string(input_string):
value = '%s 1' % input_string

return value


def clean_ows_url(url):
"""clean an OWS URL of added basic service parameters"""

url2 = QUrl(url)
url2.removeEncodedQueryItem('service')
url2.removeEncodedQueryItem('SERVICE')
url2.removeEncodedQueryItem('request')
url2.removeEncodedQueryItem('REQUEST')

return url2.toString()

0 comments on commit 067df25

Please sign in to comment.
You can’t perform that action at this time.