The basic benefit of DTML method and document is that you can use dynamic substitution in the contents. This is like the "macro" mechanism in C(of course, much more powerful). Question: Can I use the dynamic substution of DTML, but suppress the HTML rendering? For example, if I have a source program saying x <- 1 the DTML rendering will convert the string to "x <- 1". Can I suppress this? How can I do this in Python code? If I can use the DTML dynamic substitution without HTML rendering, I can let users to input some program parameters in HTML form and run the program(in my case, an statistics server based on R) through the Zope server. This can simplify HTML code, I can simply use e.g. n <- <dtml-var number_of_person> p <- <dtml-var probability_level> in the program. Or else I have to write code to convert user FORM input.
Li Dongfeng wrote:
The basic benefit of DTML method and document is that you can use dynamic substitution in the contents. This is like the "macro" mechanism in C(of course, much more powerful).
Question: Can I use the dynamic substution of DTML, but suppress the HTML rendering?
For example, if I have a source program saying
x <- 1
the DTML rendering will convert the string to "x <- 1". Can I suppress this? How can I do this in Python code?
I just tried it and it did'nt convert it. Can you be more specific about what you do ? it should do this converion only when you specify html-quote in var tag. ------- Hannu
Thanks! You are right, the "<" is not converted automatically. I used str() function in Python program with the DMML document as argument. Now I know how to do the <dtml-var ...> substitution in Python: program_code = HTML(program_code, globals())(self, REQUEST=REQUEST) This way, I can directly access user HTML form input, inside the program_code(in fact, R program). e.g., if the "program_code" holds this string: x <- "<dtml-var id>" then after the conversion, it will become x <- "my_server" (assuming "my_server" is the id now). Isn't this wonderful! Using <dtml-var ...> can only get string type data, not multiselection, lists, etc. I'll try to write an external method to convert form input to desired types(list, selections, boolean, etc.). Anyone already done this? Hannu Krosing wrote:
Li Dongfeng wrote:
The basic benefit of DTML method and document is that you can use dynamic substitution in the contents. This is like the "macro" mechanism in C(of course, much more powerful).
Question: Can I use the dynamic substution of DTML, but suppress the HTML rendering?
For example, if I have a source program saying
x <- 1
the DTML rendering will convert the string to "x <- 1". Can I suppress this? How can I do this in Python code?
I just tried it and it did'nt convert it.
Can you be more specific about what you do ?
it should do this converion only when you specify html-quote in var tag.
------- Hannu
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
Li Dongfeng wrote:
Thanks! You are right, the "<" is not converted automatically. I used str() function in Python program with the DMML document as argument. Now I know how to do the <dtml-var ...> substitution in Python:
program_code = HTML(program_code, globals())(self, REQUEST=REQUEST)
Sorry, it should be program_code = HTML(program_code, globals())(self, REQUEST) and the REQUEST parameter is provided by the caller.
This way, I can directly access user HTML form input, inside the program_code(in fact, R program). e.g., if the "program_code" holds this string: x <- "<dtml-var id>" then after the conversion, it will become x <- "my_server" (assuming "my_server" is the id now). Isn't this wonderful!
Using <dtml-var ...> can only get string type data, not multiselection, lists, etc. I'll try to write an external method to convert form input to desired types(list, selections, boolean, etc.). Anyone already done this?
Hannu Krosing wrote:
Li Dongfeng wrote:
The basic benefit of DTML method and document is that you can use dynamic substitution in the contents. This is like the "macro" mechanism in C(of course, much more powerful).
Question: Can I use the dynamic substution of DTML, but suppress the HTML rendering?
For example, if I have a source program saying
x <- 1
the DTML rendering will convert the string to "x <- 1". Can I suppress this? How can I do this in Python code?
I just tried it and it did'nt convert it.
Can you be more specific about what you do ?
it should do this converion only when you specify html-quote in var tag.
------- Hannu
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Hannu Krosing -
Li Dongfeng