Skip to content

Commit

Permalink
user std str replace instead of re module
Browse files Browse the repository at this point in the history
  • Loading branch information
luipir committed Oct 9, 2017
1 parent 378ab23 commit 5fcba06
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions python/plugins/db_manager/db_plugins/gpkg/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
* *
***************************************************************************/
"""
import re

from builtins import str

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

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

def toMapLayer(self):
from qgis.core import QgsVectorLayer
Expand Down
6 changes: 2 additions & 4 deletions python/plugins/db_manager/db_plugins/spatialite/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
* *
***************************************************************************/
"""
import re

# this will disable the dbplugin if the connector raise an ImportError
from .connector import SpatiaLiteDBConnector

Expand Down Expand Up @@ -185,7 +183,7 @@ def ogrUri(self):

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

def toMapLayer(self):
from qgis.core import QgsVectorLayer
Expand Down Expand Up @@ -270,7 +268,7 @@ def rasterliteGdalUri(self):

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

def toMapLayer(self):
Expand Down

0 comments on commit 5fcba06

Please sign in to comment.