[Zope-dev] dtml-var tag suggestion
Casey Duncan
casey.duncan@state.co.us
Fri, 28 Jul 2000 13:55:11 -0600
I have been using dtml to create dynamic JavaScripts for some forms I am
creating. In doing this I came upon the standard problem of inserting
strings containing double quotes into a JavaScript such as where title =
'"Quoted String"':
form.select.options[0].text = "<dtml-var title>";
And you wind up with this rendered:
form.select.options[0].text = ""Quoted String"";
I know there is the html_quote and sql_quote options to alleviate this
problem elsewhere. From what I can figure there is no other quote fixing
magic option for the above in the current dtml-var implementation.
Perhaps an options could be added to dtml-var in the future to handle this;
maybe something like "slash_quote". So that you get this rendered:
form.select.options[0].text = "\"Quoted String\"";
Just a thought. For now I am just going to convert all double quotes to
single quotes automagically. I guess I could modify DT_var.py, but I know
it'll get stomped the next time I upgrade my install. I guess I could submit
my changed version for inclusion in a future release, how about that?