Skip to content

Commit

Permalink
replace foo.replace( QRegExp(regexp), bar) with re.sub(regexp,bar,foo) (
Browse files Browse the repository at this point in the history
fixes #8066)
  • Loading branch information
jef-n committed Jun 15, 2013
1 parent b98e1e0 commit 192e130
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion python/plugins/GdalTools/tools/doFillNodata.py
Expand Up @@ -33,6 +33,7 @@
import GdalTools_utils as Utils

import os.path
import re

class GdalToolsDialog( QWidget, Ui_Widget, BaseBatchWidget ):
def __init__( self, iface ):
Expand Down Expand Up @@ -228,7 +229,7 @@ def batchRun(self):
for f in files:
self.inFiles.append( inDir + "/" + f )
if outDir != None:
outFile = f.replace( QRegExp( "\.[a-zA-Z0-9]{2,4}" ), outExt )
outFile = re.sub( f, "\.[a-zA-Z0-9]{2,4}", outExt )
self.outFiles.append( outDir + "/" + outFile )

self.errors = QStringList()
Expand Down
4 changes: 3 additions & 1 deletion python/plugins/GdalTools/tools/doTranslate.py
Expand Up @@ -33,6 +33,8 @@
from dialogSRS import GdalToolsSRSDialog as SRSDialog
import GdalTools_utils as Utils

import re

class GdalToolsDialog(QWidget, Ui_Widget, BaseBatchWidget):

def __init__(self, iface):
Expand Down Expand Up @@ -298,7 +300,7 @@ def batchRun(self):
for f in files:
self.inFiles.append( inDir + "/" + f )
if outDir != None:
outFile = f.replace( QRegExp( "\.[a-zA-Z0-9]{2,4}" ), outExt )
outFile = re.sub( "\.[a-zA-Z0-9]{2,4}", outExt, f )
self.outFiles.append( outDir + "/" + outFile )

self.errors = QStringList()
Expand Down
4 changes: 3 additions & 1 deletion python/plugins/db_manager/dlg_sql_window.py
Expand Up @@ -34,6 +34,8 @@
from .highlighter import SqlHighlighter
from .completer import SqlCompleter

import re

class DlgSqlWindow(QDialog, Ui_Dialog):

def __init__(self, iface, db, parent=None):
Expand Down Expand Up @@ -134,7 +136,7 @@ def getSql(self):
if sql == "":
sql = self.editSql.toPlainText()
# try to sanitize query
sql = sql.replace( QRegExp( ";\\s*$" ), "" )
sql = re.sub( ";\\s*$", "", sql )
return sql

def clearSql(self):
Expand Down

0 comments on commit 192e130

Please sign in to comment.