[Zope] wondering about rendering

Seb Bacon seb@jamkit.com
Fri, 27 Oct 2000 11:31:11 +0100


A simple question that's been bugging me:

Regarding a "FooDocument/BarMethod": How do I reference the content of
FooDocument inside BarMethod?  At the moment, I'm using
  <dtml-var "this()">
which seems to call the __str__ method of FooDocument; or
  <dtml-var "_.getitem(_['id'],1)"
where I want to render dtml too.

My questions are:
1) is 'this()' intended to be used like this?
2) is there a nicer way of doing the getitem() shenanigans?  It seems like a
common enough task to warrant a shortcut.  I feel I may be being extra dumb
here.

That's just me thinking aloud.  My actual problem, however, is that although

  content_a/view_1

returns a view of content_a, I'd like to apply in turn a new view to the
result, e.g.

  content_a/view_1/tableise

The concept being that content (content_a, content_b) can be rendered in
different ways (view_1, view_2) but is always displayed inside a table
(tableise).

If I do a <dtml-var "_.getitem(_['id'],1)"> in both view_1 and tableise, I
get infinite recursion, of course.  But I can't think of how else I might do
it.  Putting <dtml-var "this()"> in tableise makes all the HTML in view_1
render html-safe (&lt; &gt; etc).  I was tableise to display view_1's HTML
but not render its DTML.

Any idea, anyone?

Thanks, seb