[Zope] Using DTML method without HTML rendering?

Li Dongfeng mavip5@inet.polyu.edu.hk
Thu, 16 Sep 1999 14:59:32 +0800


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 &lt;- 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 )