Skip to content
Permalink
Browse files

Merge pull request #4224 from tomkralidis/metasearch-fixes-master

Metasearch fixes master
  • Loading branch information
tomkralidis committed Mar 5, 2017
2 parents 5a962e8 + 6822d6b commit 7886454c137420b41ca952b4935e90daa69457c8
Showing with 24 additions and 6 deletions.
  1. +5 −5 python/plugins/MetaSearch/dialogs/maindialog.py
  2. +19 −1 python/plugins/MetaSearch/util.py
@@ -54,10 +54,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')

@@ -723,7 +723,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
@@ -44,6 +44,7 @@
from pygments import highlight
from pygments.lexers import XmlLexer
from pygments.formatters import HtmlFormatter
from qgis.PyQt.QtCore import QUrl
from qgis.PyQt.QtWidgets import QMessageBox
from qgis.PyQt.uic import loadUiType

@@ -137,7 +138,12 @@ def get_help_url():
"""return QGIS MetaSearch help documentation link"""

locale_name = QgsSettings().value('locale/userLocale')[0:2]
version = Qgis.QGIS_VERSION.rsplit('.', 1)[0]
major, minor = QGis.QGIS_VERSION.split('.')[:2]

if minor == '99': # master
version = 'testing'
else:
version = '.'.join([major, minor])

path = '%s/%s/docs/user_manual/plugins/plugins_metasearch.html' % \
(version, locale_name)
@@ -171,3 +177,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 7886454

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