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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 2 08:08:13 PST 2016


Author: martinl
Date: 2016-01-02 08:08:13 -0800 (Sat, 02 Jan 2016)
New Revision: 67470

Modified:
   grass/trunk/gui/wxpython/gmodeler/model.py
Log:
wxGUI: modeler problems with variable (#2782)


Modified: grass/trunk/gui/wxpython/gmodeler/model.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/model.py	2016-01-02 15:58:40 UTC (rev 67469)
+++ grass/trunk/gui/wxpython/gmodeler/model.py	2016-01-02 16:08:13 UTC (rev 67470)
@@ -2515,15 +2515,15 @@
         """
         result = ''
         ss = re.split("\w*(%"+variable+")w*", string)
-
-        if not ss[0]:
+        
+        if not ss[0] and not ss[-1]:
             if data:
                 return "options['%s']" % variable
             else:
                 return variable
         
         for s in ss:
-            if s == '"':
+            if not s or s == '"':
                 continue
             
             if s == '%' + variable:
@@ -2532,7 +2532,9 @@
                 else:
                     result += '+%s+' % variable
             else:
-                result += '"' + s + '"'
+                result += '"' + s
+                if not s.endswith(']'): # options
+                    result += '"'
         
         return result.strip('+')
 



More information about the grass-commit mailing list