[Zope] DTML rendering from python?

Michiel Toneman michiel@ylnd.com
23 Jan 2003 19:39:06 +0100


On Thu, 2003-01-23 at 18:47, Dylan Reinhardt wrote:
> At 08:37 AM 1/23/2003, Michiel Toneman wrote:
> >The content manager now adds ((through a click-and-drool interface) a
> >floating box to paragraph 2 (created by Zope id="box263") and a floating
> >box to paragraph 3 (id="box544")
> 
> So the interface allows the user to associate a floating box ("box263", 
> say) with a particular insertion point (paragraph 2).
> 
> Assuming that this information is captured and stored something like the 
> following:
> 
> self._boxes[box_id] = {'box_content': 'blah blah', 'insert_point':'P3', 
> 'box_format':'size=blah;'}
> 
> Now what you need is one of two things:
> 1. A way of naming <P> tags and making calls from DTML based on the names.
> 2. A "finishing" method that inserts the correct markup *after* DTML has 
> done its job.
> 
> Looks like you already thought through idea #1 and concluded that it would 
> be very hard.  I'm inclined to agree.
> 
> But what about idea #2?  How tough would it be?
> 
...snip...
> 
> Getting warmer?


Great stuff! This should work, although more complex than the DOM
traversal. 

There is something odd going on in my product though. I tried a
different approach to the problem and managed to write the finished DTML
source into a standard PropertySheet text-property. Now I rendered that
variable in a seperate and standard DTML Document like:

<dtml-with "MyCMFolder.MyProductInstance">
  <dtml-var rendered_html>
</dtml-with> 

And the dtml in "rendered_html" doesn't expand/render either. 

There must be something I'm doing drastically wrong for this to fail
:-S. 

Is there a sort of object mime-type or environment/namespace setting
that is telling the DTML Document not to expand the DTML in the
"rendered_html" property? 

( "rendered_html" contains only <dtml-var expr="5*6"> )

Thanks for all the help so far, I'm very grateful.

Greetings,

Michiel