DTML html_quoting my JavaScript
Hi, I've got myself into a problem with DTML. The system I've been working on uses a lot of JavaScript, which is stored in DTML methods. After 14 months of development, I have been asked to reproduce the installation on another machine, where, unlike the original installation, all my <dtml-variables> are html_quoted, rendering them useless. According to the Zope book, <dtml-vars> are always html_quoted. I know this is not the case because for over a year I could successfully store JavaScripts in DTML methods. Then there is no html_unquote function. I have considered just moving the data.fs file to the new installation but I don't want to do that because 1) I want to know why this problem arose and 2) It's future dated, so I can't pack this database without changing the system time to a future date. (if anyone knows how the date of the data.fs can be modified please let me know) I doubt I'm the first to use DTML to store JavaScript, so if anyone out there knows how to stop it systematically wrecking the code, could you please please please send me some advise. Thanks, Andy Maclean
From: "Andrew Maclean" <andyjmaclean@hotmail.com>
I've got myself into a problem with DTML. The system I've been working on uses a lot of JavaScript, which is stored in DTML methods. After 14 months of development, I have been asked to reproduce the installation on another machine, where, unlike the original installation, all my <dtml-variables> are html_quoted, rendering them useless.
According to the Zope book, <dtml-vars> are always html_quoted. I know this is not the case because for over a year I could successfully store JavaScripts in DTML methods. Then there is no html_unquote function.
I have considered just moving the data.fs file to the new installation but I don't want to do that because
1) I want to know why this problem arose
and
2) It's future dated, so I can't pack this database without changing the system time to a future date. (if anyone knows how the date of the data.fs can be modified please let me know)
I doubt I'm the first to use DTML to store JavaScript, so if anyone out there knows how to stop it systematically wrecking the code, could you please please please send me some advise. Thanks,
We use a lot of javascript in our systems, but we have never used dtml-var to display the javascript (we just type the javascript into the dtml method without using any dtml tags), example <dtml-var standard_html_header> <script> your js here </script> <dtml-var standard_html_footer> You don't need to dtml-var your js code, it will be ignored by zope and passed 'as-is' to the client browser. What do you mean by 'use DTML to store JavaScript'? Are you saving js code in property fields of zope objects or something else? Jonathan
Andrew Maclean wrote at 2005-2-21 08:38 +0000:
I've got myself into a problem with DTML. The system I've been working on uses a lot of JavaScript, which is stored in DTML methods. After 14 months of development, I have been asked to reproduce the installation on another machine, where, unlike the original installation, all my <dtml-variables> are html_quoted, rendering them useless.
According to the Zope book, <dtml-vars> are always html_quoted. I know this is not the case because for over a year I could successfully store JavaScripts in DTML methods. Then there is no html_unquote function.
Indeed, dtml variable usually are not html quoted -- unless they have a sticky content (come from REQUEST). However, when you reference DTML objects, it is very easy to get an apparently HTML quoted result: <dtml-var dtml_object> will not be HTML quoted but <dtml-var "dtml_object"> appears to be. In fact, the first form calls the "dtml_object" (which means render it) while the second converts it to a string -- which returns the source, HTML-quoted such that you can read the source in your browser. -- Dieter
participants (3)
-
Andrew Maclean -
Dieter Maurer -
Jonathan Hobbs