[GRASS-SVN] r58371 - grass/trunk/gui/wxpython/gmodeler

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 3 05:45:02 PST 2013


Author: wenzeslaus
Date: 2013-12-03 05:45:01 -0800 (Tue, 03 Dec 2013)
New Revision: 58371

Modified:
   grass/trunk/gui/wxpython/gmodeler/model.py
Log:
wxGUI/gmodeler: escaping (all) characters for XML using Python saxutils (fixes #1791)

Modified: grass/trunk/gui/wxpython/gmodeler/model.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/model.py	2013-12-03 12:02:47 UTC (rev 58370)
+++ grass/trunk/gui/wxpython/gmodeler/model.py	2013-12-03 13:45:01 UTC (rev 58371)
@@ -36,6 +36,8 @@
 except ImportError:
     import elementtree.ElementTree as etree # Python <= 2.4
 
+import xml.sax.saxutils as saxutils
+
 import wx
 from wx.lib import ogl
 
@@ -1817,10 +1819,12 @@
         self._footer()
 
     def _filterValue(self, value):
-        """!Make value XML-valid"""
-        value = value.replace('<', '<')
-        value = value.replace('>', '>')
-        
+        """!Escapes value to be stored in XML.
+
+        @param value string to be escaped as XML
+        @returns a XML-valid string
+        """
+        value = saxutils.escape(value)
         return value
         
     def _header(self):



More information about the grass-commit mailing list