Skip to content

Commit 5fcba06

Browse files
committed
user std str replace instead of re module
1 parent 378ab23 commit 5fcba06

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

python/plugins/db_manager/db_plugins/gpkg/plugin.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
* *
2020
***************************************************************************/
2121
"""
22-
import re
23-
2422
from builtins import str
2523

2624
# this will disable the dbplugin if the connector raise an ImportError
@@ -191,7 +189,7 @@ def ogrUri(self):
191189
def mimeUri(self):
192190

193191
# QGIS has no provider to load Geopackage vectors, let's use OGR
194-
return u"vector:ogr:%s:%s" % (self.name, re.sub(":", "\:", self.ogrUri()))
192+
return u"vector:ogr:%s:%s" % (self.name, self.ogrUri().replace(":", "\:"))
195193

196194
def toMapLayer(self):
197195
from qgis.core import QgsVectorLayer

python/plugins/db_manager/db_plugins/spatialite/plugin.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
* *
2020
***************************************************************************/
2121
"""
22-
import re
23-
2422
# this will disable the dbplugin if the connector raise an ImportError
2523
from .connector import SpatiaLiteDBConnector
2624

@@ -185,7 +183,7 @@ def ogrUri(self):
185183

186184
def mimeUri(self):
187185
layerType = "raster" if self.type == Table.RasterType else "vector"
188-
return u"%s:%s:%s:%s" % (layerType, self.database().dbplugin().providerName(), self.name, re.sub(":", "\:", self.uri().uri(False)))
186+
return u"%s:%s:%s:%s" % (layerType, self.database().dbplugin().providerName(), self.name, self.uri().uri(False).replace(":", "\:"))
189187

190188
def toMapLayer(self):
191189
from qgis.core import QgsVectorLayer
@@ -270,7 +268,7 @@ def rasterliteGdalUri(self):
270268

271269
def mimeUri(self):
272270
# QGIS has no provider to load rasters, let's use GDAL
273-
uri = u"raster:gdal:%s:%s" % (self.name, re.sub(":", "\:", self.uri().database()))
271+
uri = u"raster:gdal:%s:%s" % (self.name, self.uri().database().replace(":", "\:"))
274272
return uri
275273

276274
def toMapLayer(self):

0 commit comments

Comments
 (0)