[GRASS-SVN] r69174 - grass/branches/releasebranch_7_2/gui/wxpython/dbmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 21 06:04:37 PDT 2016


Author: annakrat
Date: 2016-08-21 06:04:37 -0700 (Sun, 21 Aug 2016)
New Revision: 69174

Modified:
   grass/branches/releasebranch_7_2/gui/wxpython/dbmgr/base.py
   grass/branches/releasebranch_7_2/gui/wxpython/dbmgr/dialogs.py
Log:
wxGUI: escape single quotes when editing attributes from GUI, see #2252 (merge from trunk, r69153, r69173)

Modified: grass/branches/releasebranch_7_2/gui/wxpython/dbmgr/base.py
===================================================================
--- grass/branches/releasebranch_7_2/gui/wxpython/dbmgr/base.py	2016-08-21 13:02:50 UTC (rev 69173)
+++ grass/branches/releasebranch_7_2/gui/wxpython/dbmgr/base.py	2016-08-21 13:04:37 UTC (rev 69174)
@@ -1620,7 +1620,7 @@
                     columnsString += '%s,' % columnName[i]
 
                     if tlist.columns[columnName[i]]['ctype'] == str:
-                        valuesString += "'%s'," % values[i]
+                        valuesString += "'%s'," % values[i].replace("'", "''")
                     else:
                         valuesString += "%s," % values[i]
 

Modified: grass/branches/releasebranch_7_2/gui/wxpython/dbmgr/dialogs.py
===================================================================
--- grass/branches/releasebranch_7_2/gui/wxpython/dbmgr/dialogs.py	2016-08-21 13:02:50 UTC (rev 69173)
+++ grass/branches/releasebranch_7_2/gui/wxpython/dbmgr/dialogs.py	2016-08-21 13:04:37 UTC (rev 69174)
@@ -252,7 +252,7 @@
                             if ctype != str:
                                 updatedValues.append(str(newvalue))
                             else:
-                                updatedValues.append("'" + newvalue + "'")
+                                updatedValues.append("'" + newvalue.replace("'", "''") + "'")
                         columns[name]['values'][idx] = newvalue
 
                 if self.action != "add" and len(updatedValues) == 0:



More information about the grass-commit mailing list