[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3497] trunk/py/scripts/tools/bi_farm/ master_ui.py: BI Farm: fix issue with names with a ' character in them.

Brecht Van Lommel brechtvanlommel at pandora.be
Mon Jun 18 14:29:17 CEST 2012


Revision: 3497
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3497
Author:   blendix
Date:     2012-06-18 12:29:13 +0000 (Mon, 18 Jun 2012)
Log Message:
-----------
BI Farm: fix issue with names with a ' character in them.

Modified Paths:
--------------
    trunk/py/scripts/tools/bi_farm/master_ui.py

Modified: trunk/py/scripts/tools/bi_farm/master_ui.py
===================================================================
--- trunk/py/scripts/tools/bi_farm/master_ui.py	2012-06-18 10:33:20 UTC (rev 3496)
+++ trunk/py/scripts/tools/bi_farm/master_ui.py	2012-06-18 12:29:13 UTC (rev 3497)
@@ -353,16 +353,19 @@
         def table_end():
             output("</table>\n")
 
+        def escape_id(id):
+            return id.replace('\'', '\\\'')
+
         def checkbox(function, id, enabled):
             if enabled:
                 state = "checked"
             else:
                 state = ""
 
-            output("""<input type='checkbox' %s onchange='request("/exec", "%s(\\"%s\\", " + (this.checked? "True": "False") + ")")'>""" % (state, function, id))
+            output("""<input type='checkbox' %s onchange='request("/exec", "%s(\\"%s\\", " + (this.checked? "True": "False") + ")")'>""" % (state, function, escape_id(id)))
 
         def dropdown(function, id, value, options):
-            output("""<select onchange='request("/exec", "%s(\\"%s\\", \\"" + this.value + "\\")")'>\n""" % (function, id))
+            output("""<select onchange='request("/exec", "%s(\\"%s\\", \\"" + this.value + "\\")")'>\n""" % (function, escape_id(id)))
 
             for option in options:
                 if value == option:



More information about the Bf-extensions-cvs mailing list